Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
image text in transcribed
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

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions