Concept explainers
Explanation of Solution
Program:
File name: “TimesAndInstructors.java”
//Import necessary header files
import java.util.Scanner;
//Define a class named TimesAndInstructors
public class TimesAndInstructors
{
//Define main method
public static void main(String[] args)
{
//Storing the courses, times and instructors
String courses[]= {"CIS101","CIS210","MKT100","ACC150","CIS101"};
String time[]= {"Mon 9 am","Mon 11 am","Tues 8:30 am","Tues 6 pm","Fri 1 pm"};
String instructor[]= {"Johnson","Patel","Wong","Deitrich","Lennon"};
//Create an object to the Scanner class
Scanner sc = new Scanner(System.in);
//Prompt the user to enter the course name
System.out.println("Enter course name: ");
String str=sc.next();
//Assign false value to flag
boolean flag=false;
//Iterating through the courses and print the time and instructor
for(int i=0;i<courses...
Trending nowThis is a popular solution!
- write a (GUI) application that asks a user how many integers to be entered, then stores the integers in an array. Allow the user to enter all or a portion of the total integers. Display the integers from first to last, and then display the integers from last to first. Display the minimum and maximum numbers as well as the total and average of the numbers.arrow_forwardthis practcie assignment wants me to Write an application that contains an array of 10 multiple-choice quiz questions related to your favorite hobby. Each question contains three answer choices. Also create an array that holds the correct answer to each question—A, B, or C. Display each question and verify that the user enters only A, B, or C as the answer—if not, keep prompting the user until a valid response is entered. If the user responds to a question correctly, display Correct!; otherwise, display The correct answer is and the letter of the correct answer. After the user answers all the questions, display the number of correct and incorrect answers . how do i create arrays help!! here is my code that i have so far : import java util.Scanner;public class Quiz {public static void main(String[] args) {Scanner input = new Scanner(System.in);System.out.println("What is my favorite hobby?\n" + "(a)hair\n(b)makeup\n(c)both a and b\n");System.out.println("Who first discovered makeup?\n"…arrow_forwardWrite a Java application and use a two-dimensional array that will store the five top artist sales for 2017. The application must also hold the artist sales for CDs, DVDs and BLU RAY items.Your program must: Q.1.1 Create a two-dimensional array to contain the three sale items for five different artists. A single array must be used to store the artist names. Q.1.2 Allow a user to enter in a number, ranging from 1 to 5, which will represent the artist position with regards to the album sales.Q.1.3 Printout the artist name including the CD, DVD, BLU RAY sales amounts and total sales.arrow_forward
- this practice assignement wants me to Write an application that contains an array of 10 multiple-choice quiz questions related to your favorite hobby. Each question contains three answer choices. Also create an array that holds the correct answer to each question—A, B, or C. Display each question and verify that the user enters only A, B, or C as the answer—if not, keep prompting the user until a valid response is entered. If the user responds to a question correctly, display Correct!; otherwise, display The correct answer is and the letter of the correct answer. After the user answers all the questions, display the number of correct and incorrect answers here is my new code! i need help to get it to working : import java.util.*;public class Quiz {public static void main(String args[]){String questions[]=("1.What is my favorite hobby?\n" + "(a)hair\n(b)makeup\n(c)both a and b\n", "2.Who first discovered makeup?\n" +"(a)Egyptians\n(b)haitians\n(c)Africans", "3.What glue is best to use…arrow_forwardMake an application that displays a series of at least five student ID numbers (that you have stored in an array) and asks the user to enter a numeric test score for the student. Make a ScoreException class, and throw a ScoreException for the class if the user does not enter a valid score (less than or equal to 100). Catch the ScoreException, display the message Score over 100, and then store a 0 for the student's score. At the end of the application, display all the student IDs and scores. public class ScoreException extends Exception { public ScoreException(String s) { } } import java.util.*; public class TestScore { public static void main(String args[]) throws Exception { Scanner input = new Scanner(System.in); int[] ids = {1234, 2345, 3456, 4567, 5678}; int[] scores = {0, 0, 0, 0, 0}; String scoreString = new String(); final int HIGHLIMIT = 100; String inString, outString = ""; for (int x = 0; x < ids.length; ++x)…arrow_forwardCreate an array of objects of the Person class, of size 4. Create three objects of the Person class, with values, and assign the objects to the array. Loop through the array and print the name, job, and email of all Personobjects. (using the Netbeans application)arrow_forward
- Write a program called ArrayOfStudents that displays information of three students. You need to use array of objects. Each element in the array need to be initialized using a constructor. Each Student will have (name, id and Specialization). The Program will display the student information by invoking the method showStudentData(). Challenge: Can You modify the program to allow the user to enter the number of students stored in the array of objects, and ask the user to insert the details of each student.arrow_forwardYou are a manager of a Wally's Training Gym and you encourage your trainers to enroll new members. Input is the trainer's last name and the number of new enrollees. Output is the number of trainers who have enrolled members in each of three categories: 0-5 new members, 6-10 new members, and 11 to 15 new members. Write an application that allows the user to enter 15 names and the number of new members they have enrolled into an array. Output is to display the number of trainers who are in each category. Use good programming techniques that you have learned throughout the course. Use appropriate variable names, use an array to store the names and number of new enrollees, and use prompts for the input and labels with the display.arrow_forwardWrite an application named CollegeList that declares an array of four “regular”CollegeEmployees, three Faculty, and seven Students. Prompt the user tospecify which type of person’s data will be entered (C, F, or S), or allow the userto quit (Q). While the user chooses to continue (that is, does not quit), acceptdata entry for the appropriate type of Person. If the user attempts to enter datafor more than four CollegeEmployees, three Faculty, or seven Students, displayan error message. When the user quits, display a report on the screen listingeach group of Persons under the appropriate heading of “College Employees,”“Faculty,” or “Students.” If the user has not entered data for one or more types ofPersons during a session, display an appropriate message under the appropriateheading. Save the files as Person.java, CollegeEmployee.java, Faculty.java,Student.java, and CollegeList.java.arrow_forward
- You must write a small application in JAVA that stores SRC candidate names and the votes theyreceived. Your program must:1. Create an array of SRC candidate names. Populate the array with ten names.2. Create an array of votes. Populate the array with the number of votes for every candidate. Thetwo arrays work in parallel.3. Print the name of every candidate with his/her number of votes.4. Print the total number of votes casted.5. Add votes for a specific candidate.a. Read the name of the candidateb. Add one vote for the specific candidatec. Print the name of the candidate and his/her number of votesarrow_forwardYou are a manager of a Wally's Training Gym and you encourage your trainers to enroll new members. Input is the trainer's last name and the number of new enrollees. Output is the number of trainers who have enrolled members in each of three categories: 0-5 new members, 6-10 new members, and 11 to 15 new members. Write an application that allows the user to enter 15 Trainer's names and the number of new members they have enrolled into an array. Output is to display the number of trainers who are in each category. Use good programming techniques that you have learned throughout the course. Use appropriate variable names, use an array to store the names and number of new enrollees, and use prompts for the input and labels with the display. Turn in your Raptor file by clicking on the Start Here button in the upper right corner of your screen.arrow_forwardin java Develop a sales register app. The app gets the number of items being purchased from the command line, then asks for that many item descriptions and prices. After all the descriptions and prices are input, the app displays a sales receipt with: (1) each item & price,(2) the subtotal, (3) 9.75% sales tax, and (4) the total due. Format the output as shown below. Suggestion: use the number of items purchased to create two arrays, one for the descriptions and another for the prices. odio@jupiter-shovel:~/workspace$ java SalesRegister 3 Welcome to the Sales Register.Enter the description for item #1 bread What is the price of 'bread'? 1.99 Enter the description for item #2 milk What is the price of 'milk'? 2.99Enter the description for item #3 eggs What is the price of 'eggs'? 3.99 Sales Receipt bread $ 1.99 milk $ 2.99 eggs $ 3.99 ============================ Subtotal: $ 8.97 9.75% Sales Tax: 0.87 Total: $ 9.84 Thank you for using the Sales Register…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,