عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 12-04-2013, 09:27 PM   #500

nana al7rby

جامعي

 
تاريخ التسجيل: Sep 2012
التخصص: احصاء
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: أنثى
المشاركات: 5
افتراضي رد: Cpcs 202 شروحات وحلول وواجبات الجافا

دا واجبي بكرة حاولت افهم فكرتو بس ابببببدن ماطلعت بحاجا

Project 2 Deion:

A Shipping Company charges cargoes in Saudi Arabia based on the following rates :

Weight of the Cargo (in KG)

2 kg or less
Over 2 kg, but not more than 10 kg
Over 10 kg, but not more than 20 kg
Over 20 kg, but not more than 50 kg

Shipping Rate per KM

SR 0.25
SR 0.2
SR 0.15
SR 0.2

table 1

Shipping charges for the Gulf countries costs 2% more and 5% more for other countries.

write a Java program that allows the user to enter the weight of the cargo , the place and
the distance it is to be shipped(Saudi Arabia, Gulf country or other) and then displays the
charges.

Input validation:
The user has to enter S (for shipping in Saudi Arabia) , G (for shipping to Gulf countries) ,
O (for shipping to other countries). Next, the user will enter a value cargo weight and the
distance . The program will calculate the charges according to table 1. The output of the
program should be the shipping charges. In addition, consider the following scenarios in the
output:

If the user inputs a character that is not recognized (NOT S, G, or O), then the program
prints “Wrong Selection!”, and exits.

1.

If the user inputs 0 or less for the value of the cargo weight , the program will display a
message that states “the weight must be larger than Zero!”

2.

The maximum weight the company will ship is 50 KG, So if the user enter more than 50
KG, the program will display “the weight must not exceed 50KG!”

3.

These are the company’s minimum and maximum shipping distances. So your program
should not accept distances of less than 10 Km or more than 5000 KM. Display an
appropriate message to the user if entered unaccepted distance.

4.

After displaying the shipping charge ,the program should also display the discount for
the charges value according to the following rules:

5.

a. If charges value is less than or equal SR 1000, print “Discount is 0 %.”

b. If charges value is less than 10000, print “Discount is 5%.”

c. If charges value is greater than or equal 10000, print “Discount is 10%.”

The program should display a Menu for the user to choose from. The menu is shown in the
figure below.

Welcome to Shipping System

Press S for shipping in Saudi Arabia

Press G for shipping to Gulf countries

Press O for shipping to other countries

Note: Submit only the source code. For example: IA_1110348_P2.java

Sample Program Run #1:

Welcome to Shipping System

Press S for shipping in Saudi Arabia

Press G for shipping to Gulf countries

Press O for shipping to other countries

G

Enter a value for the cargo weight: 20
Enter a value for the distance: 450

Discount is 5%

The Charge of Your 20 KG Cargo will be 1308.15 SR.

كان عندي اختبارات الاسبوع اللي فات كلو ونسسسيتو اصلن ودوبها وحدة اتصلت تذكرني لو على الاقل افهم المطلوب راح احاول احلو

 

nana al7rby غير متواجد حالياً   رد مع اقتباس