In Eclipse, write a complete Java program that prompts the user for the number o
ID: 441452 • Letter: I
Question
In Eclipse, write a complete Java program that prompts the user for the number of phone calls made in each of the last 3 days, then displays the average number of phone calls per day. Make sure you program runs correctly by using the Eclipse environment (you can click the "play" button). Eclipse flags each line of code containing a syntax error with a red stop sign, you must correct all of these before your program will run. Sample output: How many phone calls did you make 2 days ago: 6 How many phone calls did you make yesterday: 2 How many phone calls did you make today: 2 On average, you have made 3.33333333333333 phone calls per day.Explanation / Answer
please rate - thanks
import java.util.*;
public class main{
public static void main(String[] args)
{int calls,sum=0;
double average;
Scanner in=new Scanner(System.in);
System.out.print("How many phone calls did you make 2 days ago: ");
sum=in.nextInt();
System.out.print("How many phone calls did you make yesterday: ");
calls=in.nextInt();
sum+=calls;
System.out.print("How many phone calls did you make today: ");
calls=in.nextInt();
sum+=calls;
average=sum/3.;
System.out.println("On average, you have made "+average+" phone calls per day.");
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.