Basic Java code help

Anonymous
timer Asked: Jul 2nd, 2013
account_balance_wallet $5

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

Tutor Answer

satishchennupati
School: Rice University

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

}
}

flag Report DMCA
Review

Anonymous
Goes above and beyond expectations !

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors