![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |
|
Registered User
Join Date: Feb 2007
Location: Shibuya,Japan
Posts: 291
OS: Windows XP Professional SP2, Windows Vista Business Edition
|
Java Help!!
Hi everyone, I having a minor difficulty in sorting the menu.
Quote:
Code:
import java.io.*;
class TestService{
public static void main(String args []){
int selection;
Service array[]=new Service[6];
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("View The Report By \n");
System.out.println("1. Service");
System.out.println("2. Price");
System.out.println("3. Time");
System.out.println("4. Exit");
try{
do{
System.out.print("Enter selection :");
selection =Integer.parseInt(br.readLine());
if(selection ==1){
array[0]=new Service("Cut",8.00,15);
array[1]=new Service("Shampoo",4.00,10);
array[2]=new Service("Manicure",18.00,30);
array[3]=new Service("Style",48.00,55);
array[4]=new Service("Permanent",18.00,35);
array[5]=new Service("Trim",6.00,5);
}else if(selection ==2){
array[0]=new Service("Shampoo",4.00,10);
array[1]=new Service("Trim",6.00,5);
array[2]=new Service("Cut",8.00,15);
array[3]=new Service("Manicure",18.00,30);
array[4]=new Service("Permanent",18.00,35);
array[5]=new Service("Style",48.00,55);
}else if(selection ==3){
array[0]=new Service("Trim",6.00,5);
array[1]=new Service("Shampoo",4.00,10);
array[2]=new Service("Cut",8.00,15);
array[3]=new Service("Manicure",18.00,30);
array[4]=new Service("Permanent",18.00,35);
array[5]=new Service("Style",48.00,55);}
}while(!=4);
System.out.println();
System.out.println("Service"+"\t\t"+"Price<$>" +"\t" + "Time<Minutes>");
System.out.println("=======" + "\t\t" +"========" +"\t" + "=============");
for(int a=0;a<6;a++)
System.out.println(array[a].toString());
}
catch(NumberFormatException ex){
System.out.println("You can only enter number");
}
catch(IOException ex){
System.out.println("Input error");
}
}
}
|
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Registered User
Join Date: Jul 2007
Location: Aberdeen
Posts: 32
OS: Windows Vista Premium
|
Is your problem getting the menu to come up or getting the final result sorted?
Excuse my ignorance but i'm more used to building a GUI with drop down menus etc
|
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Sep 2004
Posts: 302
OS: Vista (on Laptop) WinXP Pro SP3 (on Desktop)
|
Re: Java Help!!
I agree. Most of us that have been around here for awhile see this from time to time. Students just wanting the answers. Most of us have been in the students shoes and could easily provide the answer, however, this would ultimately create some stupid programmers.
I will say this, if you have a specific question (i.e. 'why is my program not getting an expected result') we can help. However, do not attempt to just toss code up (or in the extremem case = no code up) and ask us to write the programs for you. There is a reason for everything. There is a reason why you are taking a programming course. There is a reason for the classwork. I can safely say I struggled quite a lot at my first C++ course, but the struggles are what make you stronger! Okay, off of my soap box.
__________________
AMD X2 5000+ Black w/ XFX GeForce 8200 MoBo 4GB OCZ DDR2 RAM 3/4 of a TB of data storage between 2 HDD's (no RAID) |
|
|
|
![]() |
| Thread Tools | |
|
|