Lab7_5.java - /Matthew Brannon/This program takes minutes...

This preview shows page 1 - 2 out of 2 pages.

//Matthew Brannon//This program takes minutes allowed and prints a report on priceimport java.util.*;class Lab7_5 {static Scanner input = new Scanner(System.in);public static void main(String[] args) {String endProgram = "no";int minutesAllowed = 0;int minutesUsed = 0;double totalDue = 0.0;int minutesOver = 0;while (endProgram.equals("no")) {minutesAllowed = 0;minutesUsed = 0;totalDue = 0;minutesOver = 0;minutesAllowed = getAllowed(minutesAllowed);minutesUsed = getUsed(minutesUsed);minutesOver = minutesUsed - minutesAllowed;if (minutesOver < 0) {minutesOver = 0;}totalDue = calcTotal(totalDue, minutesOver);printData(minutesAllowed, minutesUsed, totalDue, minutesOver);System.out.println("Do you want to end the program? (Enter yesor no)");endProgram = input.nextLine();//Validation loopwhile (! (endProgram.equals("no")) && !endProgram.equals("yes")) {System.out.println("Please enter a value of yes or no");endProgram = input.nextLine();}}}public static double calcTotal(double totalDue, int minutesOver) {double extra = 0;if (minutesOver == 0)System.out.println("You were not over your minutes for the month");

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture