0
You are making a program for a chess tournament I Java
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.
7 Respostas
+ 6
Wow that sounds fun! Do you have any questions about it? Share your attempt.
+ 5
Well the code works. Check your spacing in your output.
0
public class Program {
public static void main(String[] args) {
int wins = 54;
int ties = 31;
float total_points = (wins *1.0f)+(ties *0.5f);
System.out.println("total points earned by player :" + total_points );
}
}
0
This was my code and the compiler is showing bug in this
Please correct it
0
ADITYA LAMBA ,
Also check your capitalization. The Sololearn code quizzes do a simple string compare between your output and the expected output. Every character has to be exactly the same to pass.
0
using System;
public class Program
{
static void Main(string[] args)
{
int wins = Convert.ToInt32(Console.ReadLine());
int ties = Convert.ToInt32(Console.ReadLine());
double pointsEarned = wins + (ties * 0.5);
Console.WriteLine(pointsEarned);
}
}
0
using System;
public class Program
{
static void Main(string[] args)
{
int wins=Convert.ToInt32(Console.ReadLine());
int ties=Convert.ToInt32(Console.ReadLine());
double d=(wins*1)+(ties*0.5);
Console.Write(d);
//your code goes here
}
}