MrMcShroom

Untitled

Sep 7th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. Programming Assignment 4
  2.  
  3.  
  4. /* Eric Engel II
  5. Program Assignment #1
  6. August 19, 2016*/
  7. import java.io.IOException;
  8.  
  9.  
  10. public class Schoolcalculator{
  11. public static void main(String []args){
  12.  
  13. int pencils;
  14. int pens;
  15. int notebooks;
  16. double ppencils;
  17. double ppens;
  18. double pnotebooks;
  19. ppencils = .50;
  20. ppens = .65;
  21. pnotebooks = 2.00;
  22. double subtotal;
  23. double tax;
  24. double total;
  25. System.out.println("Hello, welcome to my calculator.\n");
  26. System.out.println("How many pens?");
  27. pens = Keyboard.readInt();
  28. System.out.print("You want " + pens + " pens.\n");
  29. System.out.println("How many pencils?");
  30. pencils = Keyboard.readInt();
  31. System.out.print("You want " + pencils + " pencils.\n");
  32. System.out.println("How many notebooks?");
  33. notebooks = Keyboard.readInt();
  34. System.out.print("You want " + notebooks + " notebooks.\n");
  35. System.out.print("Your total for pens is " + pens*ppens + ".\n");
  36. System.out.print("Your total for pencils is " + pencils*ppencils + ".\n");
  37. System.out.print("Your total for notebooks is " + notebooks*pnotebooks + ".\n");
  38. subtotal = pens*ppens + pencils*ppencils + notebooks*pnotebooks;
  39. System.out.print("Your subtotal is " + subtotal + ".\n");
  40. tax = 1.06;
  41. total = tax*subtotal;
  42. System.out.print("Your total is " + total + ".\n");
  43. }//main
  44. }//school
Advertisement
Add Comment
Please, Sign In to add comment