So in computer science we keep getting pounded with assignments and homework!!
And on one assignment its a parking garage program which asks you how long you parked (in minutes) then charges you 75 cents for each hour. i got that part but if you stay for part of an hour you have to pay for tha full hour. How would i do that? Im off by like 1 minute and have an infinite loop which freezes my computer.
All help is very much appreciated
import java.io.*; public class Temp { public static void main(String[] args) throws IOException { BufferedReader input= new BufferedReader(new InputStreamReader(System.in)); int minutesstayed; System.out.println("Welcome to NO DENTS PARKING GARAGE"); System.out.println(); System.out.println("How long did you park for (in minutes)"); minutesstayed=Integer.parseInt(input.readLine()); int result=minutesstayed/60; double result2=result+0.75; double charge=0.75*(minutesstayed/60)+result2; for(result=1;result<=10;result2++) System.out.println("Your Parking Fee is:"+" "+charge); } }