1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
levacccp [35]
4 years ago
10

I need help with this assignment

Computers and Technology
1 answer:
Yuki888 [10]4 years ago
3 0

Answer:

import java.util.Scanner;

public class CalculatingSales {

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      int product, quantity;

      double total = 0;

      while(true) {

          System.out.println("Enter product_id and quantity(0 0 to stop): ");

          product = sc.nextInt();

          quantity = sc.nextInt();

          if(product==0 && quantity == 0)  

              break;

          switch (product) {

          case 1:

              total = total + 2.98*quantity;

              break;

          case 2:

              total = total + 4.50*quantity;

              break;

          case 3:

              total = total + 9.98*quantity;

              break;

          case 4:

              total = total + 4.49*quantity;

              break;

          case 5:

              total = total + 6.87*quantity;

              break;

          default:

              System.out.println("Invalid option");

          }

      }

      System.out.println("total value: "+total);

      sc.close();

  }

}

Explanation:

  • Take the product and quantity as input from user.
  • Use a switch statement to multiply the total with their relevant value.  
  • Display the total value.
You might be interested in
Practice using filters and tables using this document.
mestny [16]

Answer:

Do you still need help?

Explanation:

4 0
3 years ago
1. Trust can be built in a relationship if:
artcher [175]

Answer:

A

Explanation:

because if both parties feel safe communicating and feel understood by the other party they feel safe trusting the other person and it develops a trust worthy relationship

4 0
3 years ago
When you record a macro, you can assign it to run from a button or from the _____.
arsen [322]
Depends on what software you use and how you set it up. But yea it’s possible
3 0
4 years ago
Read 2 more answers
Is rhis app plagerism free
ollegr [7]
Yes,yes it is.All you do is get help
3 0
3 years ago
A(n) _____ is a list at the beginning of a publication that shows the main topics in a book or report and provides page numbers
ExtremeBDS [4]
Index or table of contents
5 0
4 years ago
Read 2 more answers
Other questions:
  • How can you recognize an unsecured wireless network?
    9·1 answer
  • QUESTION 1 _____ is a type of data encryption that enables users of the Internet to securely and privately exchange data through
    14·1 answer
  • Bitlocker uses the computer's __________ chip to store encryption keys and does not rely on individual user credentials. securit
    10·1 answer
  • Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
    6·1 answer
  • Grace whistles while tickling Camille with a feather. Eventually, Camille starts to squirm and giggle every time Grace whistles,
    10·1 answer
  • Study the sentence below
    13·2 answers
  • Rachel is a junior system administrator for a network with a single Active Directory domain. The network has just expanded to in
    6·1 answer
  • Write a statement to add the key Tesla with value USA to car_makers. Modify the car maker of Fiat to Italy. Sample output for th
    13·1 answer
  • Write the code to create a variable score and assign it the value 0?​
    6·1 answer
  • 8. Suppose you've created a bulleted list, but the bullets are too close to the text. What is the best way to fix this?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!