Write a patient billing program that displays a patient's name and bill. Here is sample output: Patient Billing Name: Jenna Parks Bill: $90.00 main follows this sequence: Loop until the user enters -1 for the patient last name. Remember you need to use a method with string comparisons; not the == relational operator. Request from the user: Patient last name Patient first name Claim amount Billing method (1 or 2) Call the adjustName method to format the first and last names. Make two separate calls to this method; one for last name and one for first name. Call the appropriate billing method: 1- Use the deductible (calcBillDeduct) method. 2- Use the medicare (calcBillMed) method. Display the following information: name billing amount The Java class contains these methods. The Chapter Five- Methods notes Area Example includes all the syntax needed for coding methods in the same class as the main method. • displayTitle method displays the title of the report: Patient Billing • adjustName method receives a name, converts the first character to uppercase and the rest to lowercase. The method returns the string. Use the code you wrote in Project One. • calcBillDeduct method receives the claim amount, calculates the patient bill as 80% of the claim after subtracting $50, and returns the billing amount. If the claim is less than or equal to $50, return a $10 fee for processing for the billing amount. • calcBilIMed method receives the claim amount, calculates the patient bill as 35% of the claim and returns the billing amount.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question

 

//********************************************************************
//EvenOdd.java Java Foundations
//
//Demonstrates the use of the JOptionPane class.
//********************************************************************

import javax.swing.JOptionPane;

public class EvenOdd
{
//-----------------------------------------------------------------
// Determines if the value input by the user is even or odd.
// Uses multiple dialog boxes for user interaction.
//-----------------------------------------------------------------
public static void main (String[] args)
{
String numStr, result;
int num, again;

do
{
numStr = JOptionPane.showInputDialog ("Enter an integer: ");

num = Integer.parseInt(numStr);

result = "That number is " + ((num%2 == 0) ? "even" : "odd");

JOptionPane.showMessageDialog (null, result);

again = JOptionPane.showConfirmDialog (null, "Do Another?");
}
while (again == JOptionPane.YES_OPTION);

System.out.println("here");
}
}

Patient Billing Problem
Write a patient billing program that displays a patient's name and bill.
Here is sample output:
Patient Billing
Name: Jenna Parks
Bill: $90.00
main follows this sequence:
Loop until the user enters -1 for the patient last name. Remember you need to use a method
with string comparisons; not the == relational operator.
Request from the user:
Patient last name
Patient first name
Claim amount
Billing method (1 or 2)
Call the adjustName method to format the first and last names. Make two separate
calls to this method; one for last name and one for first name.
Call the appropriate billing method:
1- Use the deductible (calcBillDeduct) method.
2- Use the medicare (calcBillMed) method.
Display the following information:
name
billing amount
The Java class contains these methods. The Chapter Five – Methods notes Area Example includes all
the syntax needed for coding methods in the same class as the main method.
• displayTitle method displays the title of the report: Patient Billing
• adjustName method receives a name, converts the first character to uppercase and the rest
to lowercase. The method returns the string. Use the code you wrote in Project One.
• calcBillDeduct method receives the claim amount, calculates the patient bill as 80% of the
claim after subtracting $50, and returns the billing amount. If the claim is less than or equal to
$50, return a $10 fee for processing for the billing amount.
calcBillMed method receives the claim amount, calculates the patient bill as 35% of the claim
and returns the billing amount.
*Be sure to set up constants as needed.
*All names in bold must be used as specified.
Page 1
Transcribed Image Text:Patient Billing Problem Write a patient billing program that displays a patient's name and bill. Here is sample output: Patient Billing Name: Jenna Parks Bill: $90.00 main follows this sequence: Loop until the user enters -1 for the patient last name. Remember you need to use a method with string comparisons; not the == relational operator. Request from the user: Patient last name Patient first name Claim amount Billing method (1 or 2) Call the adjustName method to format the first and last names. Make two separate calls to this method; one for last name and one for first name. Call the appropriate billing method: 1- Use the deductible (calcBillDeduct) method. 2- Use the medicare (calcBillMed) method. Display the following information: name billing amount The Java class contains these methods. The Chapter Five – Methods notes Area Example includes all the syntax needed for coding methods in the same class as the main method. • displayTitle method displays the title of the report: Patient Billing • adjustName method receives a name, converts the first character to uppercase and the rest to lowercase. The method returns the string. Use the code you wrote in Project One. • calcBillDeduct method receives the claim amount, calculates the patient bill as 80% of the claim after subtracting $50, and returns the billing amount. If the claim is less than or equal to $50, return a $10 fee for processing for the billing amount. calcBillMed method receives the claim amount, calculates the patient bill as 35% of the claim and returns the billing amount. *Be sure to set up constants as needed. *All names in bold must be used as specified. Page 1
Inputting values using Dialog Boxes (pg 311-13).
See the Evenodd. Java file for the syntax for input dialog boxes.
In this program, the user enters the four values using the showlnputDialog box. You will need this
import statement:
import javax.swing.JOptionPane;
You need these two statements to enter a numeric value:
/This statement displays the dialog box with the prompt Enter an integer, and places the integer in
the string object numStr.
numStr = JOptionPane.showlnputDialog (" Enter an integer: ");
/This statement converts the string to an integer, and assigns it to the integer variable num.
num = Integer.parselnt(numStr);
//Use this statement for doubles:
num = Double.parseDouble(numStr);
Here is a sample of the first dialog box:
Input
?
Enter patient last name: -1 to stop
OK
Cancel
Do not worry if the Cancel button causes an execution error.
Purpose of this project: Develop Java program using
o programmer-defined methods.
o dialog boxes.
o wrapper classes (page 101).
Be sure to comply with Class Standards.
Transcribed Image Text:Inputting values using Dialog Boxes (pg 311-13). See the Evenodd. Java file for the syntax for input dialog boxes. In this program, the user enters the four values using the showlnputDialog box. You will need this import statement: import javax.swing.JOptionPane; You need these two statements to enter a numeric value: /This statement displays the dialog box with the prompt Enter an integer, and places the integer in the string object numStr. numStr = JOptionPane.showlnputDialog (" Enter an integer: "); /This statement converts the string to an integer, and assigns it to the integer variable num. num = Integer.parselnt(numStr); //Use this statement for doubles: num = Double.parseDouble(numStr); Here is a sample of the first dialog box: Input ? Enter patient last name: -1 to stop OK Cancel Do not worry if the Cancel button causes an execution error. Purpose of this project: Develop Java program using o programmer-defined methods. o dialog boxes. o wrapper classes (page 101). Be sure to comply with Class Standards.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 8 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,