Course Hero Logo

ITM_311_LAB_04_SP_21 Repetitive_ControlThe_Parking_Garage.docx

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 3 out of 8 pages.

ITM 311Introduction to SoftwareDevelopmentLab 4PROJECTParking Garage - Repetition StructuresObjectiveTo type a simple Java program, execute ( run ) the program for someparticularvalues, observe the output and then modifytheprogram.PROJECT DESCRIPTIONType, compile and run the basic Java program that is shown inFigure 1,which follows.Then compile and run your program, observe the output then modify theprogram.Information About This ProjectFor this project we will create a simple fee calculator that allows for user inputand provides some calculations for displaying various totals for parking fees.Steps To Complete This ProjectSTEP 1Open NetBeans, Eclipse or Similar Java IDEOpen NetBeans or Eclipse and create a Java project with the followingdetails.For Project Name include:PrattParkingGarageFor the Main Class include:PrattParkingGarageIn yourCodewindow, shown below, copy the program code shown inFigure 1below, in the appropriate places, except substitute your ownname in place of Sammy Student.Figure 1Source Code for the Parking Garage Program// package lab4;importjava.util.Scanner;// Sammy Student, Programmerpublic classPrattParkingGarage{staticScanner sc = new Scanner(System.in);public staticvoid main(String args[]){// the local variables declared and initializedchar answer ='Y', specEvent ='N', rateCode ='\0';int ticketNum =0;int timeIn =0, timeOut =0, timeDiff =0;double amountTendered =0.0, changeDue =0.0;double flatFee =0.0, monthFee =0.0;double EXTRA_CHARGE =0.0;double coupon =0.0, tip =0.0;double flatTax =3.00, totalDueFromCust =0.0;System.out.println("");System.out.println("");System.out.println("***************************");© Copyright 2021 by P.E.P.Page 1 of 8
ITM 311Introduction to SoftwareDevelopmentLab 4System.out.println("----Pratt Parking Garage---");System.out.println("***************************");System.out.println("");System.out.println("");PROJECTParking Garage - Repetition StructuresFigure 1Source Code for the Parking Garage Program ( continued )while(answer =='Y'|| answer =='y'){System.out.println("--------- M E N U ---------");System.out.println("data entry process: enter each ofthese");System.out.println("customer ticket number ->");ticketNum = sc.nextInt();System.out.println("ticket number "+ (ticketNum));System.out.println("time in (military)");timeIn = sc.nextInt();System.out.println("time out (military)");timeOut = sc.nextInt();timeDiff = timeOut - timeIn;System.out.println("time difference "+ (timeDiff));System.out.println("rate code: (F or M)");rateCode = sc.next().charAt(0);System.out.println("rate code: "+ rateCode);if(rateCode =='F'){flatFee =10.00;totalDueFromCust = flatFee;}if(rateCode =='M'){monthFee =90.00;totalDueFromCust = monthFee;// monthly fee is deferredtotalDueFromCust = 0;}System.out.println("tip amount");tip = sc.nextDouble();System.out.printf("tip: $%.2f\n", tip);totalDueFromCust += tip;System.out.printf("flat tax: $%.2f\n", flatTax);totalDueFromCust += flatTax;System.out.println(

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 8 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
GordonS.Gehrs
Tags

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture