Basic Java code help

Programming
Tutor: None Selected Time limit: 3 Hours

How to fix java code?

Problem
Sparky Power works for Shockingly Good Electrical Company. She installs electrical boxes in commercial 
buildings. For each building she works in there is a trip charge of $125.00 and an additional charge of $51.00 for each box she installs. We need to write a program that computes the revenue for each month that Ms. Power works. For example, if 937 boxes were installed in 31 buildings Ms. Power would generate $51,662.00.
BEHAVIOR: 
The program should display on the screen a prompt for the number of buildings that Ms. Power worked in and the total number electrical boxes that she installed. The user should enter these values from the keyboard. The program should compute and display on the screen the total amount of revenue resulting from these building installations.
Here is the SS of the code so you can see the errors http://prntscr.com/1d2gvg
in writing 
import java.util.Scanner;

public class EggBasket2
{
public static void main(String[] args)
{
int buildingNumber, electricalBoxes;
final double BUILDING_CHARGE=125;
final double ELECTRICAL_BOX_COST=51;
double totalRevenue;
double buildingRevenue;
double boxRevenue;


Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the number of building:");
buildingNumber = keyboard.nextInt( );
System.out.println("Enter the number of electrical boxes:");
electricalBoxes = keyboard.nextInt( );

Compute buildingRevenue= buildingNumber * BUILDING_CHARGE;
Compute boxSum= ELECTRICAL_BOX_COST * electricalBoxes;
Compute total= buildingRevenue + boxRevenue

System.out.println("totalRevenue");

}
}

for more info here is a link
http://www.nvcc.edu/home/dfranssell/CSC130/week1%20Problem%20lecture%20handout.pdf

Nov 30th, -0001
Hi there,

please see the corrected code below

import java.util.Scanner;

public class EggBasket2
{
public static void main(String[] args)
{
int buildingNumber, electricalBoxes;
final double BUILDING_CHARGE=125;
final double ELECTRICAL_BOX_COST=51;
double totalRevenue;
double buildingRevenue;
double boxRevenue;


Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the number of building:");
buildingNumber = keyboard.nextInt( );
System.out.println("Enter the number of electrical boxes:");
electricalBoxes = keyboard.nextInt( );

buildingRevenue= buildingNumber * BUILDING_CHARGE;
boxRevenue= ELECTRICAL_BOX_COST * electricalBoxes;
totalRevenue= buildingRevenue + boxRevenue;

System.out.println("Total Revenue generate :" + totalRevenue);

}
}
Jul 2nd, 2013

The code you gave me fixes the errors but when i run it, it's not what i want

http://prntscr.com/1d2lvw
the code is suppose to tell me the revenue but here it is asking me for a number instead.

Jul 2nd, 2013

yes you first need to enter the total number of building then total number of electric boxes.. based on that it will compute.

wait i will send you a screenshot.

Jul 2nd, 2013

123.png


as in the problem description you mentioned

the total number you enter is the prompt which ms. power will enter and then they  enter total electric box they installed.



Jul 2nd, 2013

yeah look at this SS
http://prntscr.com/1d2lvw
at the bottom i do enter the number of boxes and buildings but it doesn't do anything and asks me for total revenue

Jul 2nd, 2013

i just ran the program with your example above.


in first input give 31 i.e. number of building.

in second prompt give 937 i.e. number of electric box installed.

it will calculate total revenue i.e. $ 51662.


refer the latest screenshot  undefined

Jul 2nd, 2013

replace the last line of your code i.e. system.print....


with my code line


System.out.println("Total Revenue generate :" + totalRevenue);

Jul 2nd, 2013

the best thing,,,

copy paste my entire code and run it. i used the same class name so it wont be any problem.. replace your complete code with the one i sent earlier.

Jul 2nd, 2013

Thanks worked.

Jul 2nd, 2013

thank you for allowing to help you. if you have any Java related issues you can directly contact me... i will do it for you.

Jul 2nd, 2013

hey man i am only 17 year old and don't have CC i can pay you with giftcards. Any giftcard available in 7-11. So tell me what giftcard you want.

Jul 2nd, 2013

shit.. i typed a lengthy message giving you various tips on programming and the session expired. will post it again.

hmmmm but we dont have 7-11 outlets in India... the gift cards will not be useful to me..... think of an alternative and i will also come up with some idea...

Jul 2nd, 2013

Are you studying on the go? Check out our FREE app and post questions on the fly!
Download on the
App Store
...
Nov 30th, -0001
...
Nov 30th, -0001
Dec 3rd, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer