Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I am very confused about a Java program I need to do. We are forbidden from using arrays to store values, and I need
Hello! I am very confused about a Java program I need to do. We are forbidden from using arrays to store values, and I need to add multiple inputs from dialog boxes and average these numbers, but do not know how to go about this. Here is my code
Hello! I am very confused about a Java program I need to do. We are forbidden from using arrays to store values, and I need to add multiple inputs from dialog boxes and average these numbers, but do not know how to go about this. Here is my code, images may not be in order
if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1; if(operationType.equals("knee")) knee_Count = knee_Count + 1; if(operationType.equals("Hip")) hip_Count = hip_Count + 1; while(yes_no.equals("yes")) { patientName = JOptionPane.showInputDialog("What is the patients last name"); operation Type = JOptionPane.showInputDialog("Is the operation for a knee or a hip?"); insuranceFee = JOptionPane.showInputDialog("What is the insurance fee?"); surgeon = JOptionPane.showInputDialog("Which surgeon will be performing the operation?"); yes_no =JOptionPane.showInputDialog("Would you like to enter more data?"); if(surgeon.equals("Dr. Jones")) docJones = docJones + 1; if(surgeon.equals("Dr. Emmet Brown")) docEmmetBrown = docEmmetBrown + 1; if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1; if(operationType.equals("knee")) knee_Count = knee_Count + 1; if(operationType.equals("hip")) hip_Count = hip_Count + 1; } package aassignments; import javax.swing.JOptionPane; public class Assignment) { public static void main(String[] args) { String patientName = null; String operation Type = null; String insuranceFee = null; String surgeon = null; String yes_no; String response = null; int knee_Count = 0; int hip_Count = 0; int average: int docJones = 0; int docEmmetBrown = 0; int docStrange = 0; double sum = 0; int number = 0; patientName = JOptionPane.showInputDialog("What is the patients last name"); operation Type = JOptionPane.showInputDialog("Is the operation for a knee or a hip?"); insuranceFee = JOptionPane.showInputDialog("What is the insurance fee?"); surgeon = JOptionPane.showInputDialog("Which surgeon will be performing the operation?"); yes_no =JOptionPane.showInputDialog("Would you like to enter more data?"); if(surgeon.equals("Dr. Jones")) docJones = docJones + 1; if(surgeon.equals("Dr. Emmet Brown")) docEmmetBrown = docEmmetBrown + 1; if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1; if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1; if(operationType.equals("knee")) knee_Count = knee_Count + 1; if(operationType.equals("Hip")) hip_Count = hip_Count + 1; while(yes_no.equals("yes")) { patientName = JOptionPane.showInputDialog("What is the patients last name"); operation Type = JOptionPane.showInputDialog("Is the operation for a knee or a hip?"); insuranceFee = JOptionPane.showInputDialog("What is the insurance fee?"); surgeon = JOptionPane.showInputDialog("Which surgeon will be performing the operation?"); yes_no =JOptionPane.showInputDialog("Would you like to enter more data?"); if(surgeon.equals("Dr. Jones")) docJones = docJones + 1; if(surgeon.equals("Dr. Emmet Brown")) docEmmetBrown = docEmmetBrown + 1; if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1; if(operationType.equals("knee")) knee_Count = knee_Count + 1; if(operationType.equals("hip")) hip_Count = hip_Count + 1; } package aassignments; import javax.swing.JOptionPane; public class Assignment) { public static void main(String[] args) { String patientName = null; String operation Type = null; String insuranceFee = null; String surgeon = null; String yes_no; String response = null; int knee_Count = 0; int hip_Count = 0; int average: int docJones = 0; int docEmmetBrown = 0; int docStrange = 0; double sum = 0; int number = 0; patientName = JOptionPane.showInputDialog("What is the patients last name"); operation Type = JOptionPane.showInputDialog("Is the operation for a knee or a hip?"); insuranceFee = JOptionPane.showInputDialog("What is the insurance fee?"); surgeon = JOptionPane.showInputDialog("Which surgeon will be performing the operation?"); yes_no =JOptionPane.showInputDialog("Would you like to enter more data?"); if(surgeon.equals("Dr. Jones")) docJones = docJones + 1; if(surgeon.equals("Dr. Emmet Brown")) docEmmetBrown = docEmmetBrown + 1; if(surgeon.equals("Dr. Strange")) docStrange = docStrange + 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started