Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package selection1;
- import java.util.Scanner;
- /**
- *
- * @author Emmet
- */
- public class Exercise2 {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- //Declare Variables
- double numcopies = 0;
- double totalcost = 0;
- //Get Input
- System.out.println("Enter Number Of Copies");
- numcopies = keyboard.nextDouble();
- //Do Calculations
- if (numcopies <= 50)
- {
- totalcost = numcopies * 0.05;
- System.out.println("The Total Cost Is €" + totalcost);
- }
- else if(numcopies > 50 && numcopies <= 90)
- {
- totalcost = ((numcopies - 50) * 0.04) + (50 * 0.05);
- System.out.println("The Total Cost Is €" + totalcost);
- }
- else if (numcopies > 90)
- {
- totalcost = ((40 * 0.04) + (50 * 0.05) + ((numcopies - 90) * 0.03));
- System.out.println("The Total Cost Is €" + totalcost);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement