Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SalineCamera{
- public static void main(String[] args){
- //Declare and initialize variables
- double cost8 = 2.50, cost5 = 1.22, costWallet = 0.33;
- int qty8 = 4, qty5 = 5, qtyWallet = 50;
- //Calculate the total cost for each "package"
- double totCost8 = cost8 * qty8;
- double totCost5 = cost5 * qty5;
- double totCostWallet = costWallet * qtyWallet;
- //Calculate the entire cost
- double totCost = totCost8 + totCost5 + totCostWallet;
- //Calculate the average
- double average = totCost / (qty8 + qty5 + qtyWallet);
- //Output
- System.out.println("Item\tunit cost\tqty\tcost");
- System.out.println("8x10\t$" + cost8 + "\t\t\t" + qty8 + "\t\t$" + totCost8);
- System.out.println("5x7\t$" + cost5 + "\t\t\t" + qty5 + "\t\t$" + totCost5);
- System.out.println("Wallet\t$" + costWallet + "\t\t\t" + qtyWallet + "\t\t$" + totCostWallet);
- System.out.println("Total\t\t\t\t\t\t\t$" + totCost);
- System.out.println("Average\t\t\t\t\t\t$" + average);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement