تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Exercise 2:
A company would like to create a system to track its customer visits by recording the customer details (name,
age and gender) and the bill (amount, time of visit). Beside the system should record the total amount
received and the number of customers visits.
Create class Person, class Customer, and then class CustomerVisit. You have to be aware about static variable.
Person
- name: String
- age: int
- gender: char
+ Person ()
+ Person (String, int, char)
+ setName(String): void
+ getName(): String
+ setAge(int): void
+ getAge(): int
+ setGender(char): void
+ getGender(): char
+toString(): String
Bill
- amount: double
-timeStamp: String
- total: static double
+ Bill ()
+ Bill (double, String)
+ setAmount(double): void
+getAmount(): double
+ setTimeStamp(String): void
+ getTimeStamp (): String
+getTotal(): double
+ toString: String
CustomerVisit
-personDetails: Person
- BillDetails: Bill
- NumOfVisits: static int
+ Customer ()
+ Customer (Person, Bill)
+ Customer(String, int, char, double, String)
+ setPersonDetails (Person): void
+ setPersonDetails (String, int, char):void
+ getPersonDetails (): Person
+ setBillDetails (Bill): void
+ setBillDetails (double, String):void
+getBillDetails () : Bill
+ get NumOfVisits(): int
+toString(): String
Note: Use Deep copy for the objects whenever required.
Create the following GUI, the interface should take care about
the following:
• Name, Age, and Bill Amount are TextFields to get input
from the user and it is Empty by default.
• Time Stamp is TextField to get input from the user and
it has the System Date and Time by default. But the user
can modify it.
The "Male" and "Female" radio buttons should be
grouped to specify the gender.
Visit List is a locked TextArea and it provides the output
as list of visits. Each line should include the customer
details and the bill details. Each new record should be
appended to the list.
Name of Visits and Total Amount are locked TextField
and they provides the output of the static attributes.
Customer Tracker
Name:
Age:
Bill Amount:
Gender. Male
Female
Time Stamp: 2019-10-11T13:58:16.700
Visits List
CLEAR
ADD
Num of Visits:
Total Amount:
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.