C# dancerpoints | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C# dancerpoints

help me code this one please

10th Mar 2021, 2:27 PM
Bonn Cabello
Bonn Cabello - avatar
16 Answers
+ 33
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name +" "+"&"+" "+ b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } } } i just solve it
18th Apr 2021, 12:37 PM
Fatima Ait Boujja
Fatima Ait Boujja - avatar
+ 18
class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name + " " + "&" + " " + b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } I solved it just now😭😭🤯
12th Mar 2021, 2:51 PM
Zagirov Maksim
Zagirov Maksim - avatar
+ 1
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name +" "+"&"+" "+ b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } } }
14th Jul 2021, 9:29 AM
Bharat Bhushan
Bharat Bhushan - avatar
+ 1
class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints dp1, DancerPoints dp2) { return new DancerPoints(dp1.name+" "+"&"+" "+dp2.name, dp1.points + dp2.points); } }
11th Aug 2021, 9:25 PM
yash
+ 1
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name +" "+"&"+" "+ b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } } }
7th Nov 2021, 11:18 PM
ANGEL ALEJANDRO MONTIEL ALONSO
ANGEL ALEJANDRO MONTIEL ALONSO - avatar
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints dp1, DancerPoints dp2) { string name = dp1.name +" "+"&"+" "+ dp2.name ; int points = dp1.points + dp2.points ; return new DancerPoints (name, points); } } }
25th Aug 2021, 5:01 AM
Preethi N D
0
class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator +(DancerPoints a, DancerPoints b) { string name = a.name + " " + "&" + " " + b.name; int points = a.points + b.points; DancerPoints total = new DancerPoints(name, points); return total; } }
11th Sep 2021, 11:21 AM
Jobayrul Hasan
Jobayrul Hasan - avatar
0
public static DancerPoints operator + (DancerPoints a, DancerPoints b) => new DancerPoints(a.name + " & " + b.name, a.points + b.points);
27th Apr 2022, 11:05 AM
Angy Pavía
Angy Pavía - avatar
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name +" "+"&"+" "+ b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } } } WOW AMAZING
21st May 2022, 11:35 AM
Gelbert Millones
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } public static DancerPoints operator+(DancerPoints d1,DancerPoints d2){ string s = d1.name +" & "+ d2.name; int totalpoints=d1.points+d2.points; DancerPoints total =new DancerPoints(s,totalpoints); return total; } } }
4th Oct 2022, 2:08 AM
Rania Mohammed
Rania Mohammed - avatar
0
// my solution using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator public static DancerPoints operator+ (DancerPoints a, DancerPoints b) { string name = a.name +" "+"&"+" "+ b.name ; int points = a.points + b.points ; DancerPoints total = new DancerPoints (name, points); return total ; } } }
22nd Oct 2022, 10:44 AM
Pooja Patel
Pooja Patel - avatar
0
I don't understand concept at all 💔💔
30th Jan 2023, 2:24 PM
Aghingith GJ
Aghingith GJ - avatar
0
using System; public class Program { public static void Main(string[] args) {         Console.WritLine("My first C# Code Coach!"); } }
14th May 2023, 5:07 AM
Monaliza Leges
Monaliza Leges - avatar
0
Theres a bug on this one. "DancerPoints total = new DancerPoints (name, points);" is what is "correct". Sololearn is looking for this: "DancerPoints total = new DancerPoints (nam, points);" - notice nam instead of name.
28th Jun 2023, 4:45 PM
Zachary Flynn
Zachary Flynn - avatar
- 1
Dance In a ballroom dancing competition, each dancer from a pair is evaluated separately, and then their points are summed up to get the total pair score. The program you are given takes the names and the points of each dancer as input and creates a DancerPoints objects for each dancer, using the taken name and score values as parameters for constructors. Complete the given class, using overload + operator to return an new object where the names of dancers are in one string (see sample output) and the score is equal to the sum of their points. The declaration of that object and the output of its points are already written in Main(). Sample Input Dave 8 Jessica 7 Sample Output Dave & Jessica 15
10th Mar 2021, 2:27 PM
Bonn Cabello
Bonn Cabello - avatar
- 5
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //overload the + operator } }
10th Mar 2021, 2:27 PM
Bonn Cabello
Bonn Cabello - avatar