Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Multidimensional Arrays in Java,In this lab, you must complete a Java program that uses a two-dimensional array to store data for the Building Block

Using Multidimensional Arrays in Java,In this lab, you must complete a Java program that uses a two-dimensional array to store data for the Building Block Day Care Center. The day care center charges varying weekly rates depending on the age of the child and the number of days per week the child attends. The program should allow users to enter the age of the child and the number of days per week the child will be at the day care center. The program should output the appropriate weekly rate. The file provided for this lab contains all of the necessary variable declarations, except the two-dimensional array. You need to write the input statements and the code that initializes the two-dimensional array, determines the weekly rate, and prints the weekly rate. 


Comments in the code tell you where to write the statements. Weekly rates can be found in the provided table.

Instructions


 

  1. Declare and initialize the two-dimensional array.
  2. Write the Java statements that retrieve the age of the child and the number of days the child will be at the day care center.
  3. Determine and print the weekly rate.
  4. Execute the program.


import java.util.Scanner;


 

public class DayCare

{

   public static void main(String args[]) 

   {

      // Declare two-dimensional array here.

      

      // Declare other variables.

      int numDays;   

      int age;

      String numDaysString;

      String ageString;

      int QUIT = 99;

      Scanner input = new Scanner(System.in);

            

      // This is the work done in the getReady() method

      // Perform a priming read to get the age of the child.

      

      while(age != QUIT)

      {  

         // This is the work done in the determineRateCharge() method

         // Ask the user to enter the number of days

         

         // Print the weekly rate

         

         // Ask the user to enter the next child's age

         

      }

      // This is the work done in the finish() method

      System.out.println("End of program");


 

      System.exit(0);

   } // End of main() method.

} // End of DayCare class.


 

Age: 0 1 2 3 4+ 1 30.00 26.00 24.00 22.00 20.00 2 60.00 52.00 46.00 40.00 35.00 3 88.00 70.00 67.00 60.00 50.00 115.00 96.00 89.00 75.00 66.00 5 140.00 120.00 110.00 88.00 84.00

Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

Step: 1

package dd import javautilScanner public class DayCare public static void mainString args Declare twodimensional array here double rate 3000 6000 8800 ... 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

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Programming questions