Complete the missing parts of java source code //This program calculates a running total. Here is the problem definition //Data Express, an Internet Service Provider, has requested that you develop a program to allow //sales representatives to calculate a running total of their sales based on a number of days. //The program prompts the salesperson “How many days do you have sales figures? “. //The number of days must be between 1 – 4 days (keep asking the user until a valid input is provided). //The program then prompts the user to enter a sales value for each day and calculates the total sales amount. //Name: put your name here!! //class: CSCI 1250-XXX //Exam: Quiz 4- Spring 2019 //Date: //********************************************** Total points out of ??/100 ************************************// //1- Add the missing import statement (5 points) public class Quiz4 { public static void main(String[] args) { int days; // The number of days double sales; // A day's sales figure double totalSales; // Accumulator boolean flag; //2- Declare an input variable to hold the user's input (5 points) //3- Get the number of days from the user by using JOptionPane class. (5 points) //Use this question in your input dialog("How many days do you have sales figures?"); //assign the value to input input = //4- parse the input and assign the result to days (5 points) days = //5- create a while loop that limits the number of days between 1 - 4 days (10 points) //You should keep asking for a valid value between 1 - 4 days //6- Set the accumulator to 0.0 (5 points) //7- Get the sales figures and calculate a running total using a for loop. //Correct the for loop below (5 points) FOR (int count == 1, count == days, count) { input = //8- Ask the user to "Enter the sales amount for day (count)": (5 points) sales = //9- parse input and assign it to sales (5 points) totalSales = //10- Add sales to totalSales. (5 points) //11 If sales (NOT totalSales) at any of the days exceeds $10,000 set the flag to true (10 points) //Complete the if statement if( ) { flag = } } //12-Display the total sales using a showMessageDialog with a $ (10 points) //13- if the sales for any of the days exceeds $10,000.00 (20 points) // Congratulate the user by displaying "You are outstanding!!!" //HINT: Use the flag set in for loop to check whether the sales at any of the //days has exceeded $10,000. //14- Terminate the JDK by indicating that the program has completed successfully (5 points) }//end main(String[]) }
Here's the edited java code -
//This program calculates a running total. Here is the problem
definition
//Data Express, an Internet Service Provider, has requested that
you develop a program to allow
//sales representatives to calculate a running total of their sales
based on a number of days.
//The program prompts the salesperson “How many days do you have
sales figures? “.
//The number of days must be between 1 – 4 days (keep asking the
user until a valid input is provided).
//The program then prompts the user to enter a sales value for each
day and calculates the total sales amount.
//Name: put your name here!! //class: CSCI 1250-XXX //Exam: Quiz 4-
Spring 2019
//Date:
//********************************************** Total points out
of ??/100 ************************************
// //1- Add the missing import statement (5 points)
import javax.swing.JOptionPane;
public class Quiz4 {
public static void main(String[] args) {
int days;// The number of days
double sales; // A day's sales figure
double totalSales;// Accumulator
boolean flag = false;
//2- Declare an input variable to hold the user's input (5
points)
String input;
//3- Get the number of days from the user by using JOptionPane
class. (5 points)
input = JOptionPane.showInputDialog("How many days do you have
sales figures?");
//4- parse the input and assign the result to days (5 points)
days = Integer.parseInt(input); //to convert string to integer
value
//5- create a while loop that limits the number of days between 1 -
4 days (10 points)
//You should keep asking for a valid value between 1 - 4 days
while(days<1 || days>4){ //this loop will keep repeating
until days is between 1 and 4
input = JOptionPane.showInputDialog("Invalid input, input the
number of days between 1 and 4");
days = Integer.parseInt(input); //to convert string to integer
value
}
//6- Set the accumulator to 0.0 (5 points)
totalSales = 0.0;
//7- Get the sales figures and calculate a running total using a
for loop.
for (int count = 1; count <= days; count++) {
//8- Ask the user to "Enter the sales amount for day (count)": (5
points)
input = JOptionPane.showInputDialog("Enter the sales amount for day
" + count);
//9- parse input and assign it to sales (5 points) totalSales
=
sales = Double.parseDouble(input); //to convert string to double
value
//10- Add sales to totalSales. (5 points)
totalSales = totalSales + sales;
//11 If sales (NOT totalSales) at any of the days exceeds $10,000
set the flag to true (10 points)
if(sales>10000){
flag = true;
}
}
//12-Display the total sales using a showMessageDialog with a $ (10
points)
JOptionPane.showMessageDialog(null,"total sales =
$"+totalSales);
if(flag==true){ //13- if the sales for any of the days exceeds
$10,000.00 (20 points)
// Congratulate the user by displaying "You are
outstanding!!!"
JOptionPane.showMessageDialog(null,"You are outstanding!!!");
}
//14- Terminate the JDK by indicating that the program has
completed successfully (5 points)
System.exit(0);
}
//end main(String[])
}
Complete the missing parts of java source code //This program calculates a running total. Here is...
IN JAVA PLEASE Design (pseudocode) and implement (source code) a program (name it PhoneBill) that calculates the bill for a cellular telephone company. The company offers two types of service: regular service and premium service. The rates vary depending on the type of service. The rates are computed as follows: Regular service: $15.00 fee covering first 50 minutes. Charges for over 50 minutes are computed at the rate of $0.50 per minute. Premium service: $25.00 fee plus: a. For daytime...
Write a program that calculates the calories burned while running over a given number of miles. While several factors determine how many calories are burned during a mile run, for this program, 90 calories are burned for every mile of running. The cumulative calories burned during a run can be calculated as: Calories * Distance For example, if a person runs 5 miles, the total calories burned is 450. After 3 hours, the person has burned 2 calories. The program...
.Need code for my java class !! Write a simple java program that uses loops. You may use ‘WHILE’ or ‘FOR’ or ‘DO-WHILE’ – you decide. The program should use a loop to compute the semester average for up to 5 students. In the loop the user will ask for a student name and their 3 test scores and add them up and divide the total by 3 giving the semester average. You will print out the student name and...
Write a program that calculates the average of a stream of non-negative numbers. The user can enter as many non-negative numbers as they want, and they will indicate that they are finished by entering a negative number. For this program, zero counts as a number that goes into the average. Of course, the negative number should not be part of the average (and, for this program, the average of 0 numbers is 0). You must use a method to read...
Implement a Java program using simple console input & output and logical control structures such that the program prompts the user to enter 5 integer scores between 0 to 100 as inputs and does the following tasks For each input score, the program determines whether the corresponding score maps to a pass or a fail. If the input score is greater than or equal to 60, then it should print “Pass”, otherwise, it should print “Fail”. After the 5 integer...
Part A) Write a C++ program that calculates the area under a curve. Here is the equation: f(x) = x^2 +1.5x +4 You must prompt the user for the beginning and the ending x values. You are to assume, but not check, that the user will put in whole positive numbers. The units are inches. The program input/output should look something like this: This program calculates the area under a curve between two points on the x axis. The equation...
Program Requirements · The program prompts the user to enter a loan amount and an interest rate. · The application calculates the interest amount and formats the loan amount, interest rate, and interest amount. Then, it displays the formatted results to the user. · The application prompts the user to continue. · The program stops prompting the user for values after taking 3 loan amounts. · The application calculates and displays the total loan and interest amount and ends the program Example Output Welcome to...
PAYTHON PROGRAM WITHOUT ANY FUNCTION AND METHOD A program that will allow a grocery store to keep track of the total number of bottles collected for a seven-day period. The program should allow the user to enter the number of bottles returned for each day of the seven-day period. The program will accumulate the total number of bottles returned for the 7-day period. Then calculate the amount paid out (the total bottles returned times .10 cents). The output (display) of...
In Java Programming: Create a flow chart for a program that prompts for an integer N (number of students) and M (number of test scores for each students), and allows the user to N*M real numbers. The program then calculates the average for each student and class average. (1) Prompt the user to input N students and M test scores, then display the inputs. Enter number of students: You entered: 2 Enter number of test scores: You entered: 3 Enter...
PLEASE DO THIS IN JAVA!Design (pseudocode) and implement (source code) a program (name it PhoneBill) that calculates the bill for a cellular telephone company. The company offers two types of service: regular service and premium service. The rates vary depending on the type of service. The rates are computed as follows: Regular service: $15.00 fee covering first 50 minutes. Charges for over 50 minutes are computed at the rate of $0.50 per minute. Premium service: $25.00 fee plus: a. For...