158.326 Software Construction Tutorial 1

Java Python 158.326 Software Construction

Tutorial 1

Create C# projects of Windows Forms App and Console App using Microsoft Visual Studio 2022 for the following scenario:

A payment kiosk is used by staff and customers to pay for parking tickets.

Parking rules are as follows:

Staff:

1.  The parking charges for the first ten hours are $2.00.

2.  Further parking beyond 10 hours will incur a charge of $2.00 per hour.

3.  Parking time cannot exceed 24 hours. If a car is parked for more than 24 hours, it will be towed away.

Customer

1.  The parking charges are based per hour. Parking per hour = $ 2.00

2.  Parking time cannot exceed 24 hours. If a car is parked for more than 24 hours, it will be towed away.

The program should display the parking charges for each staff or customer. Charges are calculated based on the number of hours a car has been parked.

You have to make a two-tier design:

Class Design

Identify what classes you are going to use. What will be the fields, properties and methods?

Hints:

1.   Useful Math functions: Math.Ceiling, dai 写158.326 Software Construction Tutorial 1 Math.Abs(x), Math.Floor(x), Math.Max(x,y), Math.Min(x,y)

If a person has parked for 3.5 hours, the kiosk will charge him for 4 hours. So, use Math.Ceiling function

Math.Ceiling(3.5) = 4

2.   To display output in currency format – use ToString(“C”) (refer to

http://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx

Reference:

Pro C# 5.0 and .NET4.5 Framework

Author: Andrew Troelsen

ISBN: 978-1-4302-4234-5

Edition: 6th, Publisher: Apress, E-book

Chapter 5 – Understanding Encapsulation

Chapter 6 – Understanding Inheritance and Polymorphism

Chapter 7 – Understanding Structured Exception Handling

HINT:

User interface design and sample output for your Windows Forms App

On selecting Customer or Staff, and clicking the “Next” button:

The parking amount varies for customer and staff

If parking exceeds 24 hours, an exception is thrown from a class member and caught by the form         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值