Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

The application as written does not display certain class names included in the instructions as written.

Write an application that stores at least four different course names and meeting days and times in a two-dimensional string array. Allow the user to enter a course name (such as CIS 110) and display the day of the week and times that the course is held (such as Th 330). If the course does not exist, display an error message.

import javax.swing.JOptionPane;
import java.util.Scanner;

public class Schedule {
public static void main(String[] args) {
//declare variables and arrays
final int NUM_RANGES = 4;
int sub = NUM_RANGES - 1;

String[][] classNames = {
{"COM 209", "MAT 201", "MAT 141", "ENG 220"},
{"Mon 1:00","Tue 8:30","Thu 7:30","Fri 9:15",}
};

//get input
String classInput = JOptionPane.showInputDialog("Please input a class name: ");

//match to output and print
while(sub >= 0)
--sub;

if (classInput.equals(classNames[0])) {
JOptionPane.showMessageDialog(null, "Class time is: " + classNames[0][0]);
System.exit(0);
}
else if (classInput.equals("COM 209")) {
JOptionPane.showMessageDialog(null, "Class time is: " + classNames[1][1]);
System.exit(0);
}
else if (classInput.equals("MAT 201")) {
JOptionPane.showMessageDialog(null, "Class time is: " + classNames[2][2]);
System.exit(0);
}
else if (classInput.equals("MAT 141")) {
JOptionPane.showMessageDialog(null, "Class time is: " + classNames[3][3]);
System.exit(0);
}
else if (classInput.equals("ENG 220")) {
JOptionPane.showMessageDialog(null, "Class time is: " + classNames[4][4]);
System.exit(0);
}

else {
JOptionPane.showMessageDialog(null, "Please enter a valid class name.");
System.exit(0);
}
}
}

Java, Programming

  • Category:- Java
  • Reference No.:- M91611135
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As