Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Name: James Inglis
- * Syntax: Java
- * Date: 7/28/14
- * Description: Just decided to grab a random algorithm and implement it
- * in code.
- */
- import java.util.*;
- public class Num5
- {
- static Scanner console = new Scanner(System.in);
- static final double SERVICE = 3.00;
- static final double PER_PAGE = 0.20;
- static final double ADD_PER_PAGE = 0.10;
- public static void main(String[] args)
- {
- int pages; // Stores the number of pages.
- double total; // Totaling the amount that's suppose to be paid.
- // Getting the pages.
- System.out.print("Enter in the number of fax pages: ");
- pages = console.nextInt();
- System.out.println();
- // If pages are less than 10.
- if (pages <= 10)
- {
- total = (pages * PER_PAGE) + SERVICE;
- System.out.printf("Total for pages: $%.2f", total);
- }
- // If pages are greater than 10.
- if (pages > 10)
- {
- total = SERVICE + 10 * PER_PAGE + (pages - ADD_PER_PAGE) * ADD_PER_PAGE;
- System.out.printf("Total for pages: $%.2f", total);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement