Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, Using the program below program, create a two dimensional array. The program should display several months and several years. import java.util.Scanner; public class

In Java,

Using the program below program, create a two dimensional array. The

program should display several months and several years.

import java.util.Scanner; public class MonthlyBill { public static void main(String[] args) { String arr[]= { "Jan", "Feb", "Mar", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; Scanner sc = new Scanner(System.in); System.out.print("What year would you like to enter your bill amount for: "); String year = sc.next(); System.out.print("What month would you like to enter your bill amount for: "); String start = sc.next(); int startIndex = getIndex(start,arr); double bills []=new double[12]; for(int i=startIndex;i<12;i++) { System.out.print("Please enter your bill for "+arr[i]+": "); bills[i] = sc.nextDouble(); } System.out.printf("Bill for " + year + " "); for(int i=startIndex;i<12;i++) { System.out.println(arr[i]+": $"+bills[i]); } } private static int getIndex(String start, String[] arr) { for(int i=0;i                        

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_2

Step: 3

blur-text-image_3

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

DEFINE pay equity and EXPLAIN its importance today.

Answered: 1 week ago