Dzieki za tak szybkie odpowiedzi.
Nie chce zeby ktos napisal kod tylko zeby mi podowiedzial jak to ugryzc.
musze napisac kod w netbeans tak zeby dzialal.
Jestem na pierwszym roku comp Science i to zadanie jest z java develop.
nie wiem jakiej metody uzyc bo jak na razie pobowalem z if statement do 8 gazet
Kopiuj
int mag1;
int mag2;
int mag3;
int magazine1Number;
int magazine2Number;
int magazine3Number;
System.out.println("Enter the first type of Magazine (e.g. 1) ");
mag1=in.nextInt();
System.out.println("How many of these would you like to order? ");
magazine1Number=in.nextInt();
System.out.println("Enter the first type of Magazine (e.g. 2) ");
mag2=in.nextInt();
System.out.println("How many of these would you like to order? ");
magazine2Number=in.nextInt();
System.out.println("Enter the first type of Magazine (e.g. 3) ");
mag3=in.nextInt();
System.out.println("How many of these would you like to order? ");
magazine3Number=in.nextInt();
if ( mag1==1||mag2==1||mag3==1 )
{
price=Type1;
}
if ( mag1==2||mag2==2||mag3==2 )
{
price=Type2;
}
if ( mag1==3||mag2==3||mag3==3 )
{
price=Type3;
}
if ( mag1==4||mag2==4||mag3==4 )
{
price=Type4;
}
if ( mag1==5||mag2==5||mag3==5 )
{
price=Type5;
}
if ( mag1==6||mag2==6||mag3==6 )
{
price=Type6;
}
if ( mag1==7||mag2==7||mag3==7 )
{
price=Type7;
}
if ( mag1==8||mag2==8||mag3==8 )
{
price=Type8;
}
cost1=price*magazine1Number;
totalCost=mag1+mag2+mag3;
mylalem ze bedzie ok ale przy sprawdzaniu czy programik dziala wychodzi mi za duza cena calkowita
jest to tylko 2 czesc zadania.
z pierwsza nie mialem wiekszych problemow i jest jeszcze trzecia czesc z ktoro sobie poradze.
(na koncu trec zadania oprocz 3 czesci ktora ma tylko obliczyc procent znizki jesl cena bedzie w podanym przedziale)
Z czym mam problem to jaka metode wybrac? if statement? czy swich? bo takowe tylko mielismy dotychczas na zajeciach.
moze macie jakies inne pomysly?
dzieki
You have been asked to write a software program that allows users to order magazines online.
A user has a username and password stored in the system, (assume the user has registered in the system and been assigned a username and password (you should assign these values) ).A user name should be exactly 6 characters, and password should be exactly 5 characters and password must contain at least one time the number one. When a user logs in they enter their username and password and your program should check that the entered username and password are exactly the length agreed and that they match the stored username and password.
The system needs to store the user’s Name, Address, Credit Card number(use a String) and type (e.g. MasterCard or Visa), and Date of Birth (for customer profiling). The user should be allowed to enter these details at the console.
You can assume the Magazine shop only sells the following:
• Little Kid magazine €1.30
• Teen Scene magazine €2.45
• Economist magazine €3.30
• PC Today magazine €2.75
• Best Tech Magazine €4.50
• Philosophy Today €4.40
• Writer’s Forum €5.00
• Health magazine €3.50
Your system will allow customers to purchase any number of three type of magazines (must be exactly three) and input the quantities required of those types of magazines and the total cost should be calculated and displayed to the customer.
Shalom