a.
Explanation of Solution
Program:
File name: “Alphabetize.java”
//Import necessary header files
import java.util.*;
//Define a class named Alphabetize
public class Alphabetize
{
//Define main method
public static void main(String[] args)
{
//Declare the variables
String str1, str2, str3;
//Create an object for the Scanner class
Scanner in = new Scanner(System.in);
//Prompt the user to enter the first string
System.out.print("Enter first string >> ");
str1 = in.nextLine();
//Prompt the user to enter the second string
System.out.print("Enter second string >> ");
str2 = in...
b.
Explanation of Solution
Program:
File name: “Alphabetize2.java”
//Import necessary header files
import java.util.*;
//Define a class named Alphabetize2
public class Alphabetize2
{
//Define main method
public static void main(String[] args)
{
//Declare the variables
String str1, str2, str3;
//Create an object for the Scanner class
Scanner in = new Scanner(System.in);
//Prompt the user to enter the first string
System.out.print("Enter first string >> ");
str1 = in.nextLine();
//Prompt the user to enter the second string
System.out.print("Enter second string >> ");
str2 = in.nextLine();
//Prompt the user to enter the third string
System.out.print("Enter third string >> ");
str3 = in.nextLine();
//Check if the Strings were entered in alphabetical order
if(str1.toLowerCase().compareTo(str2.toLowerCase()) < 0)
if(str2.toLowerCase().compareTo(str3.toLowerCase()) < 0)
//Print the result
System.out.println(str1 + " " + str2 + " " + str3);
else
if(str3...
Want to see the full answer?
Check out a sample textbook solution- The Huntington High School basketball team has five players named Art, Bob, Cal, Dan, and Eli. Accept the number of points scored by each player in a game and create a bar chart that illustrates the points scored, similar to the chart in Figure 6-35. Save the file as BarChart.java. 13. Command Prompt C:\Java>java BarChart Enter points scored by Art >> 6 Enter points scored by Bob >> 12 Enter points scored by Cal >> 8 Enter points scored by Dan >> 2 Enter points scored by Eli >> 20 Points for Game Art Bob Cal Dan Eli ****** ******** ******** ************ ******* C:\Java>_ Figure 6-35 Typical execution of the BarChart applicationarrow_forwardwrite an application that reads English-Language phrase and encodes it into morse code. also write an application that reads a phrase in morse code and converts it into the English-Language equivalent . Use one blank between each Morse-code letter and three blanks between each Morse-coded word.arrow_forwardX609: Magic Date A magic date is one when written in the following format, the month times the date equals the year e.g. 6/10/60. Write code that figures out if a user entered date is a magic date. The dates must be between 1 - 31, inclusive and the months between 1 - 12, inclusive. Let the user know whether they entered a magic date. If the input parameters are not valid, return false. Examples: magicDate(6, 10, 60) -> true magicDate(50, 12, 600) –> falsearrow_forward
- . Write an application for a college’s admissions office. Prompt the user for a student’s numeric high school grade point average (for example, 3.2) and an admission test score from 0 to 100. Display the message “Accept” if the student has any of the following: A grade point average below 3.0 and an admission test score of at least 80 If the student does not meet either of the qualification criteria, display “Reject”. Save the file as Admission.java.arrow_forwardIn javas coding please Write a program that opens the salesdat.txt file and processes it contents. The program should display the following per store: The total sales for each week. (Should print 5 values - one for each week). The average daily sales for each week. (Should print 5 values - one for each week). The total sales for all the weeks. (Should print 1 value) The average weekly sales. (Should print 1 value) The week with the highest amount in sales. (Should print 1 week #) The week with the lowest amount in sales. (Should print 1 week #) All Values (Total Sales, Average Daily Sales for Each Week, Total Sales for all Weeks, Average Weekly Sales, Highest Amount in Sales, Lowest Amount in Sales) The file contains the dollars amount of sales that a retail store made each day for a number of weeks. Each line in the file contains thirty five numbers, which are sales numbers for five weeks. The number are separated by space. Each line in the file represents a separate store.…arrow_forwardMust be in JAVA. Please show in simplest form and with comments.arrow_forward
- Please code in javas, thank you Write a program that opens the salesdat.txt file and processes it contents. The program should display the following per store:The total sales for each week. (Should print 5 values - one for each week).The average daily sales for each week. (Should print 5 values - one for each week).The total sales for all the weeks. (Should print 1 value)The average weekly sales. (Should print 1 value)The week with the highest amount in sales. (Should print 1 week #)The week with the lowest amount in sales. (Should print 1 week #)All Values (Total Sales, Average Daily Sales for Each Week, Total Sales for all Weeks, Average Weekly Sales, Highest Amount in Sales, Lowest Amount in Sales) The file contains the dollars amount of sales that a retail store made each day for a number of weeks. Each line in the file contains thirty five numbers, which are sales numbers for five weeks. The number are separated by space. Each line in the file represents a separate store. Please…arrow_forwardPlease solve this using java Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for names and birth-dates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birth-date or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name.arrow_forwardWrite a program that loops reading a word and displays a triangle of the word characters as shownarrow_forward
- Write a java application that handles a student report card. The application shall save the marks of computer science, math and English. Each subject has a total of 50 marks. If a student obtains at least 75/150 marks, an event will trigger and show a congratulation message on passing the exam. Otherwise, it will display an “F” grade.arrow_forwardQ: At a certain school, student email addresses end with @student.college.edu, while professor email addresses end with @prof.college.edu. Write a program in python that first asks the user how many email addresses they will be entering, and then has the user enter those addresses. After all the email addresses are entered, the program should print out a message indicating either that all the addresses are student addresses or that there were some professor addresses entered.arrow_forwardAssume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the population of the United States is 323 million and that the population is reduced 0.15 percent annually. Write an application that displays the populations for the two countries every year until the population of Mexico exceeds that of the United States, and display the number of years it took. Save the file as Population.java.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning