# Family Income Project

• January 31st, 2012, 06:52 AM
kassim05
Family Income Project
Hi Guys i really need help i duno hw to do case 2.. of my program. i duno wats wrong..

Code java:

```import java.util.*; import java.text.*;     public class SDR   { static String [] cla={"fs","Jan","Feb","Mar","Apr","May","June","Ju l","Aug","Sept","Oct","Nov","Dec"}; static Scanner input = new Scanner(System.in).useDelimiter("\r\n"); static DecimalFormat fmt=new DecimalFormat("0.00");   public static void main(String[] args)   { //declare variables int num=0; int choice=0,choice2=0; double month, euroDollars, exchangeRate, singDollars,salary; String person; while(choice!=3) while(choice2!=12)   { System.out.println("*********** Family Income ***********"); //Menu System.out.println(" 1) Enter monthly salary"); System.out.println(" 2) Display detalied salary by month"); System.out.println(" 3) Quick glance at monthly salary"); System.out.println(" 4) Exit"); //Prompt and Read Choice System.out.print("Please select your choice (1-4): "); choice = input.nextInt(); System.out.println("****************************** ******************** "); System.out.println(""); switch(choice)   { case 1: //Prompt and Read Inputs   System.out.print("Enter month (1 for Jan - 12 for Dec): "); choice2 = input.nextInt(); System.out.println("------------------------------------- "); System.out.println(""+cla[choice2]+" salary ( max 8 person)" );   do   { System.out.print("Enter person " +(++num)+"(Press ENTER to exit): "); person = input.next(); System.out.print("Enter salary :\$ "); salary= input.nextDouble(); } while(choice!=3); break;   case 2: //Prompt and Read Inputs System.out.print("Enter month (1 for Jan - 12 for Dec): "); choice2 = input.nextInt(); System.out.println("------------------------------------- ");               } }//end of main       }//end of class }```
• January 31st, 2012, 06:53 AM
kassim05
Re: Family Income Project
help please thanks.. U guys rock!
• January 31st, 2012, 07:06 AM
snowguy13
Re: Family Income Project
Make sure to surround your code in highlight tags. This is done like so:

You have cross-posted in this subforum. Cross-posting is allowed between totally different sites, but not in multiple subforums. You should read this.

Finally, when asking questions, be smart about it. None of us here knows what the problem is with your code; you haven't described what it does. Do you get errors? What is the actual output vs. the expected output?
• January 31st, 2012, 07:43 AM
KevinWorkman
Re: Family Income Project
I've deleted your duplicate post. Please read this, which you should have done before posting in the introduction forum: http://www.javaprogrammingforums.com...e-posting.html

• February 1st, 2012, 03:24 AM
kashcore
Re: Family Income Project
Quote:

Originally Posted by snowguy13
Make sure to surround your code in highlight tags. This is done like so:

You have cross-posted in this subforum. Cross-posting is allowed between totally different sites, but not in multiple subforums. You should read this.

Finally, when asking questions, be smart about it. None of us here knows what the problem is with your code; you haven't described what it does. Do you get errors? What is the actual output vs. the expected output?

I think i know where this guy is coming from. i have got a similar assignment and am stuck at the same point as him.

So, we are to write a java application over family income.
A menu of 4 choices, as he showed.

If choice is 1, user will be promted to enter the month and then to enter the salary earned.
Total number of person entered should not exceed 8.
An empty entry on the "Enter person" prompt should allow user to break out of the loop.

If choice is 2, user will be prompted to enter the month. Detailed information of the month's salary will be listed.

For example.

Enter month (1 for jan - 12 for dec) :1
Family income for Jan :
Father 2000
Mother 1500

Total family income for tge month of Jan is \$7800
________________________________________

If choice is 3, the program will generate a list of monthly total salary earned entered for the month so far.

If choice is 4 the program will display goodbye message and exit the program.
• February 7th, 2012, 06:18 AM
kassim05
Re: Family Income Project
lols... i found it guys iam done with it thanks!