Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!