Question: Write complete programs for all the problems and compile and run and make sure that the program works correctly. 1. Write a method named showChar.
Write complete programs for all the problems and compile and run and make sure that the program works correctly. 1. Write a method named showChar. The method should accept two arguments a reference to a Staring object and an integer. The integer argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position. Here is an example of a call to the method: showChar("New York",2); In this call, the method will display character w because it is in position 2. Demonstrate the method in a complete program. 2. Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in- patient out-patient. If the patient was an in-patient, the following information should be requested: . number of days spent in the hospital the daily rate hospital medication charges charges for hospital services (lab test, etc.) . If the was an out-patient, the following information should be requested: charges for hospital services (lab test, etc.) hospital medication charges . The program should use two methods to calculate the total charges. One of the methods should accept arguments for the in-patient information, while other method accepts argument for out-patient information. Both methods should return the total charges
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
