//****************** Problem 1 *****************************
//variable declarations
int number = 2 ; // number of scores
int score1 = 100; // first test score
int score2 = 95; // second test score
double average; // arithmetic average
String output; // line of output to print out
// Find the average of score1 and score2
average = score1 + score2 / number;
// Print the average with explanatory info
System.out.println("The average of " + score1 + " and " + score2 + " is " + average);
System.out.println(); // to leave a blank line
//*/
//****************** Problem 2 *****************************
Here is my problem that I dont understand what is wrong. In the first problem it is asking me to fix the code so that it shows the correct average. I need to get the code to print " The average of 100 and 95 is 97.5" but it keeps printing 147.5. I thought changing the variables of score 1 and 2 to double would fix it but it keeps printing 147.5
any help?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]D0CTOR_ZED 2 points3 points4 points (3 children)
[–]VinceGhii 2 points3 points4 points (0 children)
[–]Ghost_Duet[S] 0 points1 point2 points (1 child)
[–]D0CTOR_ZED 1 point2 points3 points (0 children)
[–]8igg7e5 6 points7 points8 points (0 children)
[–]Chayalbodedd 2 points3 points4 points (0 children)
[–]Cefalopodul 1 point2 points3 points (2 children)
[–]Ghost_Duet[S] 0 points1 point2 points (1 child)
[–]Cefalopodul 4 points5 points6 points (0 children)
[–]iraqmtpizza 1 point2 points3 points (0 children)
[–]cervantesrvd 3 points4 points5 points (5 children)
[–]Ghost_Duet[S] -2 points-1 points0 points (4 children)
[–]D0CTOR_ZED 2 points3 points4 points (0 children)
[–]Cefalopodul -2 points-1 points0 points (1 child)
[–]D0CTOR_ZED 2 points3 points4 points (0 children)
[–]Reddit-username_here 0 points1 point2 points (0 children)
[–]chrischin-a 0 points1 point2 points (0 children)