Question

Lab 7 Example Output Products that cost $100.00or mone Enter the product ordered type stop to end: flat screen TV Enter the c
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

import java.util.Scanner;
public class Main
{
private static Scanner input=new Scanner(System.in);
public static void main(String[] args)
{
String productName;
int count;
double productCost,total,average;
System.out.println("Peoduct that cost $100.00 or more.");
count=0;
total=0;
while(true)
{
  
System.out.print("Enter the producted ordered - typer 'Stop' to end: ");   
productName=input.nextLine();
if(productName.equalsIgnoreCase("Stop"))
break;
System.out.print("Enter the cost of producted ordered : ");
productCost=input.nextDouble();
  
if(productCost>=100.00)
{
total+=productCost;
count++;
}
input.nextLine();
}
average=total/count;
System.out.println("There were "+count+" item(s) that had a cost of $100.00 or more");
System.out.println("The average price of items with a cost of $100.00 or more is $"+average);
System.out.println("End of report.");
}
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
Lab 7 Example Output Products that cost $100.00or mone Enter the product ordered type stop to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a java program which will prompt a user to input a product and its cost....

    Create a java program which will prompt a user to input a product and its cost. Using a while loop that will run until the sentinel value of “stop” (any case) is entered, the program will look for items with a cost greater than or equal to $100.00. The program will find the average cost of those items. Note: immediately after your statement containing input.nextDouble() you will need to add the following input.nextLine() statement. This will cause the input scanner...

  • This question has already been answered however I do not understand the particulars of the answer....

    This question has already been answered however I do not understand the particulars of the answer. for an example why are we importing an average class I thought that we could solve the problem just inputting the scanner and doing the import command at the top. Also at the bottom of the problem they increment the counter I thought you increment the counter at the top. Is there any way someone could do a detailed step-by-step explanation of the actual...

  • In this practice program you are going to practice creating graphical user interface controls and placing...

    In this practice program you are going to practice creating graphical user interface controls and placing them on a form. You are given a working NetBeans project shell to start that works with a given Invoice object that keeps track of a product name, quantity of the product to be ordered and the cost of each item. You will then create the necessary controls to extract the user input and display the results of the invoice. If you have any...

  • 13) The cost the Almy type of market 7) The market is an example of A)...

    13) The cost the Almy type of market 7) The market is an example of A) mattress: a monopoly B) com a perfectly competitive C) car insurance an oligopoly D) cell phone; a perfectly competitive 5) airplane manufacturing a monopolistically competitive 8) What is the difference between perfect competition and monopolistic competition? A) Perfect competition has a large number of small firms while monopolistic competition does not in monopolistic competition, firms produce identical goods, while in perfect competition, firms produce...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that...

    Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT