Java programming errors

Anonymous
timer Asked: Feb 12th, 2016

Question description

I am having several errors when I try to run my java program source code. I have 3 programs to run but in all 3 I have errors and I dont know how to fix them. I need your help so I can know how to fix these types of java errors.

here is my source code for the first one:

import java.util.Scanner;

public class Ch3Proj6dxc4187

{

public static void main(String[] args)

{

double BMRFemale, BMRMale;

int weightInPounds, heightInInches, ageInYears, word;

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter weight in pounds: ");

weightInPounds = keyboard.nextInt();

System.out.println("Enter height in inches: ");

heightInInches = keyboard.nextInt();

System.out.println("Enter age in years: ");

ageInYears = keyboard.nextInt();

System.out.println("Are you sedentary, somewhat active, active, or highly active?");

word = keyboard.nextInt();

BMRFemale = 655 + (4.3 * weightInPounds) + (4.7 * heightInInches) - (4.7 * ageInYears);

BMRFemale = BMRFemale/230;

BMRMale = 66 + (6.3 * weightInPounds) + (12.9 * heightInInches) - (6.8 * ageInYears);

BMRMale = BMRMale/230;

System.out.println("The amount of bars consumed by a female are: " + BMRFemale);

System.out.println("The amount of bars consumed by a male are: " + BMRMale);

double sedentaryFemale = BMRFemale + 0.2;

double sedentaryMale = BMRMale + 0.2;

double somewhatActiveFemale = BMRFemale + 0.3;

double somewhatActiveMale = BMRMale + 0.3;

double activeFemale = BMRFemale + 0.4;

double activeMale = BMRMale + 0.4;

double highlyActiveFemale = BMRFemale + 0.5;

double highlyActiveMale = BMRMale + 0.5;

if (BMRFemale == sedentaryFemale)

sedentaryFemale = BMRFemale + 0.2;

else if (BMRMale == sedentaryMale)

sedentaryMale = BMRMale + 0.2;

else if (BMRFemale == somewhatActiveFemale)

somewhatActiveFemale = BMRFemale + 0.3;

else if (BMRMale == somewhatActiveMale)

somewhatActiveMale = BMRMale + 0.3;

else if (BMRFemale == activeFemale)

activeFemale = BMRFemale + 0.4;

else if (BMRMale == activeMale)

activeMale = BMRMale + 0.4;

else if (BMRFemale == highlyActiveFemale)

highlyActiveFemale = BMRFemale + 0.5;

else if (BMRMale == highlyActiveMale)

highlyActiveMale = BMRMale + 0.5;

}

}

here is my source code for the second one:

import java.util.Scanner;

public class Ch3Proj5dxc4187

{

public static void main(String[] args)

{

double BMRFemale, BMRMale;

int weightInPounds, heightInInches, ageInYears;

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter weight in pounds: ");

weightInPounds = keyboard.nextInt();

System.out.println("Enter height in inches: ");

heightInInches = keyboard.nextInt();

System.out.println("Enter age in years: ");

ageInYears = keyboard.nextInt();

BMRFemale = 655 + (4.3 * weightInPounds) + (4.7 * heightInInches) - (4.7 * ageInYears);

BMRFemale = BMRFemale/230;

BMRMale = 66 + (6.3 * weightInPounds) + (12.9 * heightInInches) - (6.8 * ageInYears);

BMRMale = BMRMale/230;

double Man, Woman;

if (BMRMale == Man) {

Scanner reader = new Scanner(System.in);

System.out.println("Enter M for man: ");

int n = reader.nextInt();

}

if (BMRFemale == Woman)

{

System.out.println("Enter W for woman: ");

System.out.println("The amount of bars consumed by a female are: " + BMRFemale);

System.out.println("The amount of bars consumed by a male are: " + BMRMale);

}

}

}

here is my source code for the third one:

import java.util.Scanner;

public class Ch3Proj1dxc4187

{

public static void main(String[] args)

{

Scanner in = new Scanner(System.in);

System.out.println( "Enter price of an item: " );

int price = in.nextInt();

int change = 100 - price;

int quarters = change/25;

change = change % 25;

int dimes = change/10;

change = change % 10;

int nickels = change/5;

change = change%5;

{

if (price < 25)

System.out.println("This is an error, cost under 25 cents!");

else if (price > 100)

System.out.println("This is more than a dollar.");

else (!price.equals(5))

System.out.println("This is not an integer multiple of 5!");

}

System.out.println("You bought an item for " + price + " cents and gave me a dollar so your change is:");

    System.out.println("\t" + quarters + " quarters,");

    System.out.println("\t" + dimes    + " dimes, and");

    System.out.println("\t" + nickels  + " nickels");

}

}


Tutor Answer

(Top Tutor) Studypool Tutor
School: Rice University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

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