Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Programming Assignment 4
- /* Eric Engel II
- Program Assignment #1
- August 19, 2016*/
- import java.io.IOException;
- public class Schoolcalculator{
- public static void main(String []args){
- int pencils;
- int pens;
- int notebooks;
- double ppencils;
- double ppens;
- double pnotebooks;
- ppencils = .50;
- ppens = .65;
- pnotebooks = 2.00;
- double subtotal;
- double tax;
- double total;
- System.out.println("Hello, welcome to my calculator.\n");
- System.out.println("How many pens?");
- pens = Keyboard.readInt();
- System.out.print("You want " + pens + " pens.\n");
- System.out.println("How many pencils?");
- pencils = Keyboard.readInt();
- System.out.print("You want " + pencils + " pencils.\n");
- System.out.println("How many notebooks?");
- notebooks = Keyboard.readInt();
- System.out.print("You want " + notebooks + " notebooks.\n");
- System.out.print("Your total for pens is " + pens*ppens + ".\n");
- System.out.print("Your total for pencils is " + pencils*ppencils + ".\n");
- System.out.print("Your total for notebooks is " + notebooks*pnotebooks + ".\n");
- subtotal = pens*ppens + pencils*ppencils + notebooks*pnotebooks;
- System.out.print("Your subtotal is " + subtotal + ".\n");
- tax = 1.06;
- total = tax*subtotal;
- System.out.print("Your total is " + total + ".\n");
- }//main
- }//school
Advertisement
Add Comment
Please, Sign In to add comment