Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prompt: Edit your Lab 4 program so that the user can re-use the program if they want, until want to quit. This is for Java

Prompt:

Edit your Lab 4 program so that the user can re-use the program if they want, until want to quit.

This is for Java Program, and I am using Eclipse.

My Lab 4 is attached:

image text in transcribed

I think I need to use "while" or "if" statement, but I am very confused how exactly it needs to be. I tried writing "gender != 'f' || ' m' ", but it did not work. Maybe I just did it wrong. Though, I got stuck on how to reuse the program if the user wants to use the program again.

Please help me out with the code that should ask whether or not the user wants to continue with the program, and if he/she does, reuse the program.

import java util Scanner public class Lab4 static Scanner console new Scanner System in) public static void main String args) 1 TODO Auto-generated method stub Scanner scan new Scanner System in char gender; Double A1,A2, A3 ,A4,A5, B Double Body Fat BodyFatPercentage System out.println( 'm' for Me 'f' for Women system out.print Gender gender scan .next charAt(0); if gender f. System out.print In "Body Weight A1 scan next Double( 0.732)+8.987) System out.println "Wrist Measurement A2 SCa next Double 3.14 System out.println "Waist Measurement A3 Scan next Double )*0.157) System "Hip Measurement A4 (scan next Double() 0.249) System Forearm Measurement AS Scan ext Double() 0.434) Ba A1 +A2-A3-A4+AS Body Fat (CA, 1-8.987)/0.732) B;I Body Fat Percentage Body Fat 100)/ 8.987) 732 System out.println Gender gender) System out.print in "Body Fat +Body Fat out.printin "Body Fat Percentage +Body Fat Percentage system else if gender 'm' System out.println "Body Weight: A1 C scan next Double 1.082)+94.42) System out.printin "Waist Measurement A2 scan .next Double 4.15); A1-A2 Body Fat (CA1 91.42) 1.082) Body Fat Percentage Body 100) (CA1 94.42) /1.082)) Fat system out.println Gender gender System out.print "Body Fat +Body Fat system out.printin ''Body Fat Percentage +Body FatPercentage)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What is the entrepreneurial process?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago