Ask Question
20 November, 01:42

an online retailter sells two products: widgets and gizmos each widget weighs 75 grams. each gizmo weighs 112 grams. write a program the reads the numbers of widgets and the number of gizmos in an order from th user the your program should compute and discplay the total weight of the order

+2
Answers (1)
  1. 20 November, 05:17
    0
    import java. util.*;

    public class OnlineSell {

    public static void main (String [] args) {

    Scanner input = new Scanner (System. in);

    double total = 0;

    System. out. print ("Enter the number of widgets: ");

    int widgets = input. nextInt ();

    System. out. print ("Enter the number of gizmos: ");

    int gizmos = input. nextInt ();

    total = (widgets * 75) + (gizmos * 112);

    System. out. println ("The total weight of the order is: " + total + " grams");

    }

    }

    Explanation:

    - Ask the user to enter the number of widgets and gizmos

    - Calculate the total weight by multiplying the numbers of widgets with 75 and the number of gizmos with 112, and summing these two values

    - Print the total
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “an online retailter sells two products: widgets and gizmos each widget weighs 75 grams. each gizmo weighs 112 grams. write a program the ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers