Question: Need assistance Java code for a blood Content Caculator. This is what I have below /* * File: Blood Content Calculator * Author: * Date:

Need assistance Java code for a blood Content Caculator. This is what I have below

/* * File: Blood Content Calculator * Author: * Date: November 3, 2017 * Purpose: This program calculates and prints the * blood content base on the input from the user. */

// Import Statements import Java.util.Scanner;

public class BAC { public static void main(String[] args){ //variable declaration double weight = 0; String gender = 0; double time = 0; int numDrinks = 0; // Use the Scanner class to input data Scanner scannerIn = new Scanner(System.in);

System.out.println("How much do you weigh? (pounds)"); double weight = scannerIn.nextDouble(); System.out.println("Male or Female?"); String gender = scannerIn.next(); System.out.println("How many hours have you been drinking?"); double time = scannerIn.nextDouble(); System.out.println("How many drinks have you had?"); int numDrinks = scanner.nextInt(); //Verify calculation was entered int i=1; double bac = 0; double currentBAC = 0; double widmark = (gender.toLowerCase().charAt(0) == 'f') ? 0.73 : 0.66; while (i<=numDrinks){ System.out.println("What was the volume of drink #" +i +"? (ounces)"); double volume = scanner.nextDouble(); System.out.println("What was the % abv of that drink?"); double abv = (scanner.nextDouble())/100; System.out.println("How many times did you have this drink?"); double drinkCount = scanner.nextDouble(); bac += (volume*abv*5.14)/(weight*widmark); i += drinkCount; } //Output of Alcohol Blood Content currentBAC = bac - 0.015*time;

if (currentBAC >= 0){ System.out.println("Your blood alcohol content is probably around " + currentBAC); } else{ System.out.println("Your blood alcohol content should be normal by now"); } } }

I am still recieving erron. Thank you for any help you can give me

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!