Question: Edit this Java code using printf INSTEAD of tabs. When using tabs, I get an output like this---- I also want to keep the method

Edit this Java code using printf INSTEAD of tabs. When using tabs, I get an output like this----

Edit this Java code using printf INSTEAD of tabs. When using tabs,

I also want to keep the method that validates the input data but I do NOT want it to display if an entry is valid, ONLY display if it is invalid. I need it to look exactly like the Execution output below----

I get an output like this---- I also want to keep the

import java.text.DecimalFormat; import java.text.Format; import java.util.Scanner;

public class test {

public static void main(String[] args) { Scanner scanner = new Scanner(System.in);

System.out.println("Name\tHeart Rate\tResp Rate\tHeight\tWeight\tBMI\tBP\t\tScore");

while (scanner.hasNext()) {

String name = scanner.next(); int heartRate = scanner.nextInt(); int respiratoryRate = scanner.nextInt(); int height = scanner.nextInt(); int weight = scanner.nextInt(); int systolicPressure = scanner.nextInt(); int diastolicPressure = scanner.nextInt(); double BMI = calculateBMI(height, weight);

if (isInputDataValid(heartRate, respiratoryRate, height, weight, systolicPressure, diastolicPressure)) { System.out.println("valid"); System.out.print(name + "\t\t"); int score = 1; if (heartRate >= 60 && heartRate = 12 && respiratoryRate

if (isInputDataValid(heartRate, respiratoryRate, height, weight, systolicPressure, diastolicPressure)) { System.out.println("valid"); System.out.print(name + "\t\t"); int score = 1; if (heartRate >= 60 && heartRate = 12 && respiratoryRate = 90 && systolicPressure = 60 && diastolicPressure

static boolean isInputDataValid(int heartRate, int respiratoryRate, int height, int weight, int systolicPressure, int diastolicPressure) { if (heartRate == 0 || respiratoryRate == 0 || height == 0 || weight == 0 || systolicPressure == 0 || diastolicPressure == 0) return false; else return true; }

static double calculateBMI(int height, int weight) { double BMI = (((double) weight) * 0.453592d) / ((((double) height) * 0.0254) * (((double) height) * 0.0254)); Format f = new DecimalFormat("##.##"); return Double.parseDouble(f.format(BMI)); } }

Trinity valid Morpheus valid Cypher valid Dozer valid Tank valid Neo valid Jones valid Apoc 100 80 80 80 101 110 80 60 11 68 19 18 82 15 82 15 70 15 72 19 69 15 140 72 174 175 220 130 21.286691 110/70 175 23.734004 110/70 18.507319 89/70 18.507319 89/70 24.966124 110/70 23.734004 110/55 32.487961 110/55 121/70 23.777048

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!