رد: Cpcs 202 شروحات وحلول وواجبات الجافا
اتفضلي اختي هذا الحل للبروجيكت الثاني
import javax.swing.JOptionPane;
public class DA_1011244_project2 {
public static void main(String[] args) {
char A;
double wit=0,dis,co=0,price=0,all=0;
String str=JOptionPane.showInputDialog(null,
"\n Press S for shipping in Saudi Arabia"
+"\n Press G for shipping to Gulf countries"
+"\n Press O for shipping to other countries",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
A=str.charAt(0);
if((A=='S')||(A=='G')||(A=='O'))
{
str=JOptionPane.showInputDialog(null,
"\n Enter the weight:",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
wit=Integer.parseInt(str);
if(wit>0&&wit<=50)
{if(wit>0&&wit<=2)
co=wit*0.25;
if(wit>2&&wit<=10)
co=wit*0.2;
if(wit>10&&wit<=20)
co=wit*0.15;
if(wit>20&&wit<=50)
co=wit*0.2;
str=JOptionPane.showInputDialog(null,
"\n Enter the distance:",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
dis=Integer.parseInt(str);
if(dis>=10&&dis<=5000)
{
price=co*dis;
}
else
{
JOptionPane.showMessageDialog(null,
"the distaenc must not exceed 5000 KM",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
}
else
{
JOptionPane.showMessageDialog(null,
"the weight must not exceed from 0 to 50KG!",
"\nWelcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
}
else
{
JOptionPane.showMessageDialog(null,"Wrong selection !",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
if(A=='G')
price=price+(price*0.02);
if(A=='O')
price=price+(price*0.05);
if(price>0&&price<=1000)
{
all=price;
JOptionPane.showMessageDialog(null,
"\n Discount is 0% The Charge of Your "+wit+" KG Cargo will be "+all+" SR",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
else if (price>1000&&price<10000)
{
all=price-(price*0.05);
JOptionPane.showMessageDialog(null,
"\n Discount is 5% The Charge of Your "+wit+" KG Cargo will be "+all+" SR",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
else if(price>=10000)
{
all=price-(price*0.1);
JOptionPane.showMessageDialog(null,
"\n Discount is 10% The Charge of Your "+wit+" KG Cargo will be "+all+" SR",
"\n Welcome to Shipping System",
JOptionPane.PLAIN_MESSAGE);
}
}
}
بس انا اطلب من الشباب يساعدوني في حل البروجيكت الثالث لأنه على نفس البروجيكت الثاني
وتلاقوا المطلوب في المشاركة اللي بعدها الله يسعدكم بأسرع وقت لأنه تسليمه السبت وعندي اختبار كمان
|