The office hours for Professor X in Spring 2021 are as follows: Monday 3:00pm - 5:00pm...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The office hours for Professor X in Spring 2021 are as follows: Monday 3:00pm - 5:00pm Thursday 3:30pm - 5:00pm Friday 3:00pm - 4:30pm Note that all office hours are in the late afternoon. For this lab assignment, you will write a program that will take the day of the week and a time (XX:XXam/pm) as inputs, and will output whether the professor is available during that time on that day. Start Apache NetBeans. Create a new project called YourlastnameLab4 with your last name. Declare a String variable to represent the day of the week. Prompt the user for the day of the week and store it in the variable from step 3. The result should look like this: Enter the day of the week: Monday Declare a String variable to represent the time of day. Prompt the user for the time of day in the format XX:XXam/pm (e.g., 10:45am, 3:30pm), and store it in the variable from step 5. The result should look like this: Enter a time (XX:XXam/pm): 4:15pm Declare two int variables to represent the hour and minute, and a String variable to represent a value of "am" or "pm". Use the String class length, indexOf, and substring methods to process time to extract the hour, minute, and am/pm information. Store the results in the three variables from step 7. You will need to use the Integer.parseInt method to convert a String to an int. int number = Integer.parseInt("42"); // converts "42" to 42 Use if-else statements to display the entered day of the week in the following format: Day of the week: Monday Use the String class equals IgnoreCase method to identify the entered input in different format (e.g. "Mon", "mon", "MON", "Monday", "monday", "MONDAY"). Use the logical OR operator || to build the Boolean expressions. . 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. For each day when the professor does not have office hour (Tuesday, Wednesday, Saturday, Sunday), add an additional statement that displays "Not Available". For days, when the professor has office hours (Monday, Thursday, and Friday), write nested if-else statements within the respective if-else statements described in step 9 to check whether the professor is available at that particular time. There are 3 cases to consider. If the time entered is AM, display "Not Available" since the professor's office hours are in the late afternoon. If the time entered is PM, and it's within the office hour time, then display "Available" If the time entered is PM, but it's not within the office hour time, then display "Not Available". Use the String class equals method to check whether the entered time is "am" or "pm". To check the whether the entered time is during the office hours, use Java comparison and logical operators. The office hours for Professor X in Spring 2021 are as follows: Monday 3:00pm - 5:00pm Thursday 3:30pm - 5:00pm Friday 3:00pm - 4:30pm Note that all office hours are in the late afternoon. For this lab assignment, you will write a program that will take the day of the week and a time (XX:XXam/pm) as inputs, and will output whether the professor is available during that time on that day. Start Apache NetBeans. Create a new project called YourlastnameLab4 with your last name. Declare a String variable to represent the day of the week. Prompt the user for the day of the week and store it in the variable from step 3. The result should look like this: Enter the day of the week: Monday Declare a String variable to represent the time of day. Prompt the user for the time of day in the format XX:XXam/pm (e.g., 10:45am, 3:30pm), and store it in the variable from step 5. The result should look like this: Enter a time (XX:XXam/pm): 4:15pm Declare two int variables to represent the hour and minute, and a String variable to represent a value of "am" or "pm". Use the String class length, indexOf, and substring methods to process time to extract the hour, minute, and am/pm information. Store the results in the three variables from step 7. You will need to use the Integer.parseInt method to convert a String to an int. int number = Integer.parseInt("42"); // converts "42" to 42 Use if-else statements to display the entered day of the week in the following format: Day of the week: Monday Use the String class equals IgnoreCase method to identify the entered input in different format (e.g. "Mon", "mon", "MON", "Monday", "monday", "MONDAY"). Use the logical OR operator || to build the Boolean expressions. . 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. For each day when the professor does not have office hour (Tuesday, Wednesday, Saturday, Sunday), add an additional statement that displays "Not Available". For days, when the professor has office hours (Monday, Thursday, and Friday), write nested if-else statements within the respective if-else statements described in step 9 to check whether the professor is available at that particular time. There are 3 cases to consider. If the time entered is AM, display "Not Available" since the professor's office hours are in the late afternoon. If the time entered is PM, and it's within the office hour time, then display "Available" If the time entered is PM, but it's not within the office hour time, then display "Not Available". Use the String class equals method to check whether the entered time is "am" or "pm". To check the whether the entered time is during the office hours, use Java comparison and logical operators.
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner Class construction public class YourlastnameLab4 public static void mainStrin... View the full answer
Related Book For
Business Analytics And Statistics
ISBN: 9780730363330
1st Edition
Authors: Ken Black, John Asafu Adjaye, Paul Burke, Nelson Perera, Carl Sherwood, Saleh A. Wasimi
Posted Date:
Students also viewed these programming questions
-
Jack owns an initial wealth (W0) of $30. Inadvertently, he agreed to enter into the following game : - With 1/4 probability his wealth goes up to $50 - With 1/2 probability his wealth stays the same...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Demand function for a firm is given as P-100e, if the firm's average cost (AC) is AC 5+50, determine the firm's maximum profit. (5marks).
-
Why is Supplier Relationship is important to a business. explain
-
One electron travels twice as fast as another. Which has the longer wavelength?
-
Describe the mechanics of exchange rate management.
-
1. What is the total if \(28 \%\) of the total is 140 ? 2. What is the total if \(6 \%\) of the total is 91 ?
-
On January 1, 2008, Crocker Company issued 10-year, $2,000,000 face value, 6% bonds, at par. Each $1,000 bond is convertible into 15 shares of Crocker common stock . Crockers net income in 2008 was...
-
Date Activities Units Acquired at Cost Units Sold at RetailMarch 1 Beginning inventory 100 units @ $50 per unit March 5Purchase 400 units @ $55 per unit March 9 Sales 420 units @ $85 perunit March 2...
-
1. Jim Adams posts the column totals and individual transactions in "Other" columns to the appropriate general ledger account and updates each general ledger account balance. He places a posting...
-
Process Improvement Flowchart As-Is Process Flow Chart Evaluation Select a process from an organization you work for or are familiar with. You will use this process in your Week 2 & Week 4 Signature...
-
Two point charges lie on the x axis. A charge of 6 . 1 \\ mu C is at the origin, and a charge of - 9.8\\ mu C is at x = 1 0 . 0 cm . What is the net electric field at x = 4 . 0 cm ? What is the net...
-
Discuss the international financial system and in relation to forex.
-
what ways can firms leverage strategic portfolio management techniques, dynamic resource allocation mechanisms, and risk-adjusted performance metrics to optimize their investment decisions, balance...
-
The acceleration of a particle is given by a(t)=-2.03 m/s + (3.04 m/s)t. Find the initial velocity voz such that the particle will have the same x-coordinate at time t = 3.93 s as it had at t = 0....
-
A financial policy supporting management's decision to liquidate assets, raise capital to initiate a share buyback program to common shareholders, and pay dividends to preferred shareholders does not...
-
What are some of the advantages of using SAP that Global Bike Inc enjoys? In order to leverage these advantages what are some of the steps that Global Bike Inc takes to minimize the effort consumed...
-
At Glass Company, materials are added at the beginning of the process and conversion costs are added uniformly. Work in process, beginning: Number of units Transferred - in costs Direct materials...
-
A recent survey of Australians found that mean sleep time was 8 hours with a standard deviation of 3 hours. Assume sleep time is normally distributed. What is the probability that: (a) A randomly...
-
A university conducted a study into students perceived usability of a proposed upgrade to the existing learning management system (LMS). Students were asked to visit a test site and evaluate the...
-
A car fleet manager working for a local council is thinking of gradually replacing the current fleet of vehicles used by the council with vehicles that use LPG (gas) rather than petrol. The concern...
-
On January 1, 2008, Boggs, Inc. paid \($700,000\) for 100,000 shares of Mattly Corporation, which represented 30% of Mattlys outstanding common stock. Boggs made the following computation: The excess...
-
Sage, Inc. bought 40% of Adams Corporations outstanding common stock on January 2, 2008 for \($400,000.\) The carrying amount of Adams net assets at the purchase date totaled \($900,000\). Fair...
-
In January 2008, Harold Corporation acquired 20% of Otis Companys outstanding common stock for \($400,000.\) This investment gave Harold the-ability to exercise significant influence over Otis. The...
Study smarter with the SolutionInn App