Answer:
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