Pages: 1

  2010-06-30 12:39:15

mystic rain
» FTalkWhiz
FTalk Level: zero
2963
0
1969-12-31

Hello there I need help ): I'm still a beginner when it comes to java o.o and so I still have this kind of difficulty in making such kind of java programs... here's the little background of my progra

Hello there I need help ): I'm still a beginner when it comes to java o.o and so I still have this kind of difficulty in making such kind of java programs... here's the little background of my program. The program will display its' item to sell and also its' prices. The use will then choose what item he/she will buy after choosing one item... the user will then decide if how many items he/she should buy. After that... the program will then display how much is his/her payment... [quote]import java.util.Scanner; import java.util.Arrays; public class Practice{ public static void main(String [] args){ Scanner inputted=new Scanner(System.in); String[] items=new String [5]; items[0]="Jacket"; items[1]="Pants"; items[2]="Blouse"; items[3]="Bag"; items[4]="Shoes"; Double[] price= new Double[5]; price[0]=10.00; price[1]=25.00; price[2]=35.00; price[3]=15.00; price[4]=5.00; int numberOfItems=0; double total=0.0; System.out.println("What is your name?"); String yourName=inputted.nextLine(); System.out.println("\nWelcome to Rain's Store "+ yourName); System.out.println("Items:"); for(int y=0;y<x.length;y++){ System.out.println(x[y] + " = "+ price[y]+"pesos"); System.out.println("your chosen item:"); String yourItem=inputted.nextLine(); for(int y=0;y<x.length;y++) { if(yourItem==item[y]) { System.out.println("How many"+ item[y]+ "do you like?"); int numberOfItems=lol.nextInt(); for(int x=1;x<=numberOfItems;x++) double total=total + price[y]; break; } break; } } }[/quote] corrections about my program are well appreciated or in other words your help.

Pages: 1

Board footer

© 2025 F Talk

Current time is 06:03

[ 12 queries - 0.009 second ]
Privacy Policy