ProductsLogo
LogoStudy Documents
LogoAI Grader
LogoAI Answer
LogoAI Code Checker
LogoPlagiarism Checker
LogoAI Paraphraser
LogoAI Quiz
LogoAI Detector
PricingBlogAbout Us
logo

Parking Ticket System

Verified

Added on  2019/09/26

|7
|581
|173
Practical Assignment
AI Summary
The provided assignment content is a C program that simulates a parking ticket system. The program prompts the user to input the duration of their parking, calculates the parking charges based on the duration, and then allows the user to pay for the parking using RM10.0, RM5.0, or RM1.0 notes. The program continues to prompt the user to insert payment until the total bill is paid, and then prints out a receipt if requested.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Unit Co-ord./Lecturer OFFICE USE ONLY
Assignment received:
Tutor:(if applicable)
Student ID
Student Name
Unit Code
Unit Name
Assignment
Title/Number
Word Count
I 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 the
University website at www.utas.edu.au/plagiarism *
Signed Date

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
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 hours
printf("Enter Hour >>");
scanf("%d", &hours);
// prompt for input minutes
printf("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 minutes
totalbill=0;
}
else if( hours >= 1 && hours <= 3 )
{
//condition for 1-3 hours
if(minutes == 0)
{
totalbill = 2+(hours-1)*1;
}
else
{
totalbill = 2+(hours+1-1)*1;
}
Document Page
}
else
{
// condition for greater than 3 hours
totalbill=5;
}
printf("Parking Charges : RM %d.0\n\n", totalbill);
// start paying bill
while(totalbill>0)
{
// show bill and prompt to input notes
printf("Please insert payment RM%d.0 >> ",
totalbill);
scanf("%d", &rm);
// checking for valid notes
if(rm == 10 || rm == 5 || rm == 1)
{
// adding in amount paid
totalpaid=totalpaid+rm;
// deducting from total bill
totalbill=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 notes
printf("\nInvalid note provided. Please enter
only RM10.0, RM5.0 or RM1.0 notes\n\n");
continue;
}
}
fflush(stdin);
Document Page
printf("wait for parking ticket to be printed out\n\
n");
printf("Do you want a receipt >> ");
// first scanf is just to empty input buffer
scanf("%c", &choice);
// input choice for receipt print
scanf("%c", &choice);
if(choice=='Y')
{
printf("Printing receipt\n\n");
}
printf("Thank You\n");
}

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Document Page
Document Page
1 out of 7
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]