Programming
Basic Java code help

Question Description

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

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

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);

}
}

Rice University

Anonymous
Really helpful material, saved me a great deal of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4