عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 30-04-2012, 11:14 AM   #461

m-aal qasim

جامعي

 
تاريخ التسجيل: Apr 2012
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الأول
الجنس: ذكر
المشاركات: 5
Skaau.com (15) رد: Cpcs 202 شروحات وحلول وواجبات الجافا

السلام عليكم ورحمة الله وبركاته
ياشباااب نقرتين لعرض الصورة في صفحة مستقلة الله يحفظكم ويزيدكم من علمه وفضله
نبغى شرح للبروجيكت الثاني
اللي عنده شرح لا يبخل علينا
وشكرا للجميع
نقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلة


Project 2 Deion:
In this project you will extend the Java program you have written for the General Department of Traffic in Project 1 (see attached). You are expected to make some code enhancements to implement the following changes:
1. Display reports for n number of traffic tickets one by one. Your program keeps accepting tickets details and displaying reports until the user confirms he does not want to enter any more ticket information. In other words, after displaying a report for the first ticket you ask the user if he wants to continue entering another ticket or quit. [You must use JOptionPane class].

2. To save entry time, the month of the violation will be entered now as a digit (1-12).You must write a method called toMonth that accepts month as digit and returns back equivalent month as String. For example, if the program invokes toMonth(12), it returns back “December”.
The calculation of the violation ticket will now be implemented using two methods as described in 3 and 4.

3. Write a method computeSpeedingFee to compute speeding ticket fee. This method accepts unpaid previous fee, other charges, violation level, and returns the total ticket Fee according to the speeding ticket fee table in Project 1.

4. Write a method computeNonSpeedingFee to compute non-speeding ticket fee. This method accepts unpaid previous fee, other charges, violation type, violation level, and returns the total ticket Fee according to the other violations ticket fee table in Project 1.
At the end of the entry session, upon exiting the program, display a final report [Also using JOptionPane class] that contains the following:

5. The grand total amount due on all violators for the entry session. This is the total money the General Department of Traffic must receive from all violators.

6. A warning statement: “Warning: amount of tickets entered exceeds 3000 SAR,” if the total money of all tickets entered is greater than 3000 SAR.

7. The number of tickets entered.

8. How many times each violation type has occurred for each entry session. Display each one of the seven traffic violation types and the number of its occurrences. For example:

Violation Type Number of occurrences
Parking 2
Speeding 3
Reckless Driving 2
. .
. .
Others 4

Note that logically the sum of the numbers of occurrences must be equal to the number of tickets entered that is displayed in 7.

END OF PPRJECT 2



ATTACHMENT: PROJECT 1
In this project you will write a Java program for the General Department of Traffic to enter information of a traffic violation ticket (using JOptionPane class), compute the ticket fee and total fees, and display a report (also using JOptionPane class). The report contains details such as the name of the violator, the ticket number, the nationality of the violator, the national ID for Saudi citizens or Iqama No. of non-Saudis, the violation type and level, the day, month and year of the violation, name of the street where the violation occurred, the speed if the violation is speeding, previous unpaid tickets fees, and total fees due.

Your program must contain the following information:


· Violator name (String) [user entry]
· Ticket No. (int) [user entry]
· Nationality of violator (String) [user entry]
· National ID or Iqama No. (int) [user entry: this depends on the nationality of the violator]
· Violation type (short) [user entry] can be any of the following:
[Parking = 1, Speeding = 2, Reckless Driving = 3, Crossing a red light = 4, Failure to use a seat built = 5, Driving on the shoulder = 6, Others = 7].

· The violation level to indicate the seriousness level of some of the violations (byte) [user entry] can be either[High = 1, Medium = 2, Low = 3]
· The speed (int) [user entry: only if the violation is Speeding]
· The max speed of violation level 1 (constant short = 120)
· The max speed of violation level 2 (constant short = 100)
· The max speed of violation level 3 (constant short = 80)
· The day of the violation (short) [user entry]
· The month of the violation (String) [user entry]
· The year of the violation (int) [user entry]
· Street name (String) [user entry]
· Other Charges (double) [user entry] [Apply Check, cannot be less than zero]
· Unpaid previous fees (double) [user entry] [Apply Check, cannot be less than zero]
· Total ticket Fee (double) = unpaid previous fees + other charges + current ticket fee (check fee tables below) based on violation type.








The ticket fee (in Saudi Riyals) depends on the type of the violation and its level as shown the following Table:
Violation
Type

Violation Level
Parking
Speeding
Reckless
Driving
Crossing a red light
Failure to use a seat built
Driving on the shoulder
Others
High
300
See next table
900
1200
100
200
100
Medium
200
600
900
Low
100
300
600





For speeding violations, the ticket fee depends on the conditions shown in the following table:
Max speed of level n
Violator’s speed
Ticket Fee
n = 1
Less than or equal 10 kph over max speed of the level
300
Less than or equal 20 kph over the max speed of the level
900
More than 20 kph over the max speed of the level
1200
n = 2
Less than or equal 10 kph over max speed of the level
300
Less than or equal 20 kph over the max speed of the level
600
More than 20 kph over the max speed of the level
900
n = 3
Less than or equal 10 kph over max speed of level
300
Less than or equal 20 kph over the max speed of the level
550
More than 20 kph over the max speed of the level
800

Note: kph is kilometers per hour.



For example, suppose the user of your program has entered the following information:
· Violator name: ABC
· Ticket No.:8782612
· Nationality of violator: Saudi
· National ID or Iqama No.: 1005850011
· Violation type: 2
· Violation level: 1
· Violation speed: 150
· The day of the violation: 17
· The month of the violation: March
· The year of the violation: 2012
· Street name: Aljamah Street
· Other Charges: 90
· Unpaid previous fees: 100

The program must compute and display, within the report, the total ticket fee according to the formula:
Total ticket Fee = unpaid previous fees + other charges + current ticket fee
For the previous input, the total ticket fee = 100 + 90 + 1200 = 1390.00 SAR. Since the violation type is 2 (speeding) and its level is 1 (n = 1), and the speed over limit = 150 – max speed of level 1(120) = 30 > 20 kph, hence the current ticket fee is 1200 (see the speeding table).
Based on the user entry, the program should display a report (using JOptionPane class) of the following format:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
General Department of Traffic
Ticket No.: 8782612 Date: 17 March 2012
Violator Name: ABC Nationality: Saudi ID: 1005850011
Violation Type: Speeding Violation Level: High
Street name: Aljamah Street Speed: 150
Unpaid Fees: 100 Other Charges: 90 Current Fee: 1200
Total fees: 1390.00 SAR
Note: You have to pay the total fees within 30 days to avoid extra charges.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Note: if the violation type is not speeding, then display not applicable (N/A) in the speed field of the report. For example:
Speed: N/A
END OF PROJECT DIION.
GOOD LCUK!

 

m-aal qasim غير متواجد حالياً   رد مع اقتباس