| | |
how do i make this program?
![]() |
•
•
Join Date: Mar 2009
Posts: 6
Reputation:
Solved Threads: 0
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!
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!
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.
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 !!!
•
•
Join Date: Mar 2009
Posts: 6
Reputation:
Solved Threads: 0
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];
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];
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
When you need to calculate the result for the values just loop through the arrays with
java Syntax (Toggle Plain Text)
for(int i=0;i<f;i++){ result[i]=Revenue[i] - Costs[i] - Salary[i]; }
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
•
•
Join Date: Mar 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
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
java Syntax (Toggle Plain Text)
for(int i=0;i<f;i++){ result[i]=Revenue[i] - Costs[i] - Salary[i]; }
i think its my positioning that is wrong
i dont know how
![]() |
Similar Threads
- Make a VB Program run in the background? (VB.NET)
- how to make this program short (C++)
- Make my own IM program and MySpace Clone. (PHP)
- need help to make this program work (C++)
- trying to make a program to say the change due back after a purchase is made (C++)
- Can I make my C program understand that a key has been pressed? (C++)
- How to make my program detecct when the computer is going to LOGOFF or SHUTDOWN (C)
- how can i make the program depend on time (C)
Other Threads in the Java Forum
- Previous Thread: 5 digit palindrome program
- Next Thread: combo box containg check box as its elements in java
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth bold business c++ chat class clear client code codesnippet collections component coordinates database defaultmethod development dice doctype dragging ebook eclipse educational error file formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide ideas image infinite ingres integer intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie openjavafx parameter php problem program programming project recursion repositories scanner scrollbar sell server set sms sort sorting sql sqlserver state storm string sun superclass swing swt threads tree websites windows






