how do i make this program?

Reply

Join Date: Mar 2009
Posts: 6
Reputation: weinyeong is an unknown quantity at this point 
Solved Threads: 0
weinyeong weinyeong is offline Offline
Newbie Poster

how do i make this program?

 
0
  #1
Mar 23rd, 2009
can anyone help me with this school project?
they want me to create something like this :
using Net income = Revenue - costs - salary
net income percentage is by multiplying (Net income)/(Revenue Ratio) with 100%

Handphone net income computation
-----------------------------------
1. Press A to enter Revenue and Costs
2. Press B for Net Income
3. Press C to exit
please enter selection :

Option A
--------
Revenue <please enter 2 dec places > :
Costs <please enter 2 dec places > :
Salary <please enter 2 dec places > :

Handphone net income computation
-----------------------------------

Option B
--------
items amount<$> percentage<%>
----- ----------- ---------------
Revenue (numbers)
Cost (numbers)
Salary (numbers)
====== ========== ============
net income (final answer) (final percentage)


Handphone net income computation
-----------------------------------
1. Press A to enter Revenue and Costs
2. Press B for Net Income
3. Press C to exit
please enter selection : Y <---------(wrong selection)

please enter A, B, or C only.

Handphone net income computation
-----------------------------------
1. Press A to enter Revenue and Costs
2. Press B for Net Income
3. Press C to exit
please enter selection :







umm someone PLEASE HELP ME!
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,563
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: how do i make this program?

 
0
  #2
Mar 23rd, 2009
Nobody is going to baby you through your projects. Start by asking some specific questions. If you don't know any Java programming I suggest you read a tutorial or three.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 822
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: how do i make this program?

 
0
  #3
Mar 23rd, 2009
Try creating the menu and sub menus first, so that they correctly reflect what the description specifies. Once you have done this you could later on move to the calculation and output part.

Use the Scanner class to take user input.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 6
Reputation: weinyeong is an unknown quantity at this point 
Solved Threads: 0
weinyeong weinyeong is offline Offline
Newbie Poster

Re: how do i make this program?

 
0
  #4
Mar 23rd, 2009
im stuck at the part which i cant put the choices A B or C
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,563
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: how do i make this program?

 
0
  #5
Mar 23rd, 2009
Did you write any code yet?
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 6
Reputation: weinyeong is an unknown quantity at this point 
Solved Threads: 0
weinyeong weinyeong is offline Offline
Newbie Poster

Re: how do i make this program?

 
0
  #6
Mar 23rd, 2009
yes i did
i'll post the part i did :
import java.text.*;
import java.util.*;

public class Exam {

static Scanner input=new Scanner(System.in).useDelimiter("\r\n");

static DecimalFormat fmt=new DecimalFormat("0.00");

static Double[] result = new Double [10];

static Double[] Revenue = new Double [10];

static Double[] Costs = new Double [10];

static Double[] Salary = new Double [10];

static String[] type= new String [10];



static int choice, f=0;


static char selection, select;

public static void main(String[] args)throws Exception
{

do
{
System.out.println();
System.out.println("Handphone Net Income Computation");
System.out.println("========================");
System.out.println("1. Press A to enter Revenue and Costs ");
System.out.println("2. Press B for Net Income");
System.out.println("3. Press C to exit");
System.out.print("Please enter selection : ");
choice=input.nextInt();

switch(choice)
{



case 1: firsttest();
break;

case 2: summary();
break;






default: System.out.println();
System.out.println("Please enter A, B or C only.\n");
break;

}

}while(choice!= 3);

}//end of main

static void firsttest() throws Exception{




System.out.println();
System.out.println();
System.out.println("Option A");
System.out.println("--------");


System.out.print("Revenue <Please enter 2 dec places> : ");
Revenue[f]=input.nextDouble();

System.out.print("Cost of handphone <Please enter 2 dec places> : ");
Costs[f]=input.nextDouble();

System.out.print("Salary <please enter 2 dec places> : " );
Salary[f]=input.nextDouble();


selection=(char)System.in.read();
System.in.read();
System.in.read();

}
static void summary() throws Exception{

result[f]=Revenue[f] - Costs[f] - Salary[f];
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 6
Reputation: weinyeong is an unknown quantity at this point 
Solved Threads: 0
weinyeong weinyeong is offline Offline
Newbie Poster

Re: how do i make this program?

 
0
  #7
Mar 23rd, 2009
and im stuck right now
i cant make the Revenue - cost - salary calculation thingy
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 822
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: how do i make this program?

 
0
  #8
Mar 23rd, 2009
Firstly you need to increment the variable 'f' or else all values are going to go to the index position of the array, since f is initially 0.

When you need to calculate the result for the values just loop through the arrays with
  1. for(int i=0;i<f;i++){
  2. result[i]=Revenue[i] - Costs[i] - Salary[i];
  3. }
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,563
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: how do i make this program?

 
0
  #9
Mar 23rd, 2009
And use code tags. Read the forum rules.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 6
Reputation: weinyeong is an unknown quantity at this point 
Solved Threads: 0
weinyeong weinyeong is offline Offline
Newbie Poster

Re: how do i make this program?

 
0
  #10
Mar 23rd, 2009
Originally Posted by verruckt24 View Post
Firstly you need to increment the variable 'f' or else all values are going to go to the index position of the array, since f is initially 0.

When you need to calculate the result for the values just loop through the arrays with
  1. for(int i=0;i<f;i++){
  2. result[i]=Revenue[i] - Costs[i] - Salary[i];
  3. }
i still cant get it to show the calculations
i think its my positioning that is wrong
i dont know how
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC