Sei sulla pagina 1di 2

TUTORIAL 6

Exercise 1: Consolidate knowledge related to access modifiers


in Java via a simple model of a university.

Exercise 2: Write a program to simulate a simple parcel


container with the following features:
1. Sign-in:
[+] Ask user to type his/her account (email, password).
- Email must not be start with a digit and must be end
with “@gmail.com”.
- Password must contain at least 1 digit and there are at
least 6 characters in length.
[+] After 3 times of typing invalid account, stop the
program and print message to user to indicate that the
account has been blocked.
[+] Sig-in successfully will enable user to do feature 2.
2. Propose user the most compatible box which its size is
nearest larger than or equal to the weight of the sending
parcel which would be provided by user with the bellow
rule:
[+] <= 5 kg: Propose size XS.
[+] > 5 kg and < 10 kg: Propose size S.
[+] >= 10 kg and <= 13 kg: Propose size M.
[+] > 13 kg and < 16 kg: Propose size L.
[+] >= 16 kg and < 20 kg: Propose size XL.
[+] Other weight: Propose size XXL.

Potrebbero piacerti anche