+ 7
Chess Tournament Scores
Introduction java Chess Tournament Scores practice is buged the answer is wrong i don't know what to do now pls help.
17 Answers
+ 16
Your code?
+ 13
System.out.println(wins+0.5*ties);
+ 7
Leon, so everyone can help you. Please write what the task is and then save and attach your code in the code playground.
+ 5
Chess Tournament Scores
You are making a program for a chess tournament, that needs to calculate the points earned by a player.
A win is worth 1 point, while a tie is worth 0.5 points.
The given program declares two variables: wins and ties with the corresponding values.
Create a program to calculate and output the points earned by the player.
public class Program {
public static void main(String[] args) {
int wins = 54;
int ties = 31;
System.out.println(wins+0.5*ties);
i did this and it didn't work. i looked at the solution and it is the same it just doesn't work.
+ 4
</CODER> "ty" is text talk for Thank You
+ 3
using system;
public class chass;
Public static void main(string args[]) {
wins=Convert.ToInt32(Console.ReadLine());
ties=Convert.ToInt32(Console.ReadLine());
Console.WriteLine(wins*0.5*ties);
}
}
+ 2
Hello everyone!
He's what I did and it worked!
Here's the answer:
public class Demo {
public static void main(String[] args) {
double wins = 54;
double ties = 31;
double points = wins + ties*0.5;
System.out.print(points);
}
}
The result must be 69.5
+ 1
ty :)
+ 1
public class Program {
public static void main(String[] args) {
double wins = 54.0;
double ties = 31.0;
double x = ties * 0.5;
System.out.println(x+wins);
}
}
+ 1
public class Program {
public static void main(String[] args) {
int wins = 54;
int ties = 31;
System.out.println(wins+0.5*ties);
}
}
+ 1
using System;
public class Program
{
static void Main(string[] args)
{
int wins;
int ties;
//your code goes here
Console.WriteLine();
wins = int.Parse(Console.ReadLine());
Console.WriteLine();
ties = int.Parse(Console.ReadLine());
double points = wins + (ties * 0.5);
Console.WriteLine( points);
}
}
+ 1
System.out.println(wins+0.5*ties);
Working
0
It seems like the int for ties makes it rounded down. 31*0.5 should be 15.5, but in that code it would be 15, which would be wrong.
0
public class Program {
public static void main(String[] args) {
//declare variables
String name = "Howard";
/* declare the age
int age = 42;
*/
//output values
//System.out.println(name+" is "+age+" years old.");
}
}
0
wins + (ties * 0.5)