logo

Parking Ticket System

   

Added on  2019-09-26

7 Pages581 Words173 Views
 | 
 | 
 | 
Unit Co-ord./LecturerOFFICE USE ONLYAssignment received:Tutor:(if applicable)Student IDStudent NameUnit CodeUnit NameAssignmentTitle/NumberWord CountI declare that all material in this assignment is my own work except where there is clear acknowledgement or reference to the work of others and I have complied and agreed to the University statement on Plagiarism and Academic Integrity on theUniversity website at www.utas.edu.au/plagiarism *Signed Date
Parking Ticket System_1

C Program:#include<stdio.h>void main(){int hours=0, minutes=0;int totalbill=0, totalpaid=0;int rm;char choice;printf("\t\ttB J PARKING TICKET SYSTEM\n\n");printf("Insert Parking Ticket\n");//prompt for input hoursprintf("Enter Hour >>");scanf("%d", &hours);// prompt for input minutesprintf("Enter Minutes >>");scanf("%d", &minutes);printf("\n\nDuration parking: %d hours %d minutes\n", hours, minutes);if(hours == 0 && minutes <=20){//condition for less than 20 minutestotalbill=0;}else if( hours >= 1 && hours <= 3 ){//condition for 1-3 hoursif(minutes == 0){totalbill = 2+(hours-1)*1;}else{totalbill = 2+(hours+1-1)*1;}
Parking Ticket System_2

}else{// condition for greater than 3 hourstotalbill=5;}printf("Parking Charges : RM %d.0\n\n", totalbill);// start paying billwhile(totalbill>0){// show bill and prompt to input notesprintf("Please insert payment RM%d.0 >> ", totalbill);scanf("%d", &rm);// checking for valid notesif(rm == 10 || rm == 5 || rm == 1){// adding in amount paidtotalpaid=totalpaid+rm;// deducting from total billtotalbill=totalbill-rm;printf("Total RM%d.0\n\n", totalpaid);if(totalbill<0){printf("Balance is RM%d.0\n\n", 0-totalbill);}}else{// prompt for invalid notesprintf("\nInvalid note provided. Please enter only RM10.0, RM5.0 or RM1.0 notes\n\n");continue;}}fflush(stdin);
Parking Ticket System_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
The order of the substitution
|11
|1382
|18

Implementation of Linked List
|5
|1119
|220

Queue Implementation using Linked List
|3
|442
|243

C Programming: Stack Implementation and Score Analysis
|11
|1305
|31

Hostel Management System
|25
|1266
|447

Implementation of Stack using Linked List
|3
|427
|344