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
-
In an earth reference frame, a star is 82 light-years away. How fast would you have to travel so that to you the distance would be only 35 light-years?
-
37. Given the line: y=x-2 a. Find the parallel slope b. Find the perpendicular slope 38. Determine if the lines are parallel or perpendicular: a. -2x+5y=9 and 5x+2y=-6 b. 4y =8x+12 and -12x+6y=24 39....
-
Comment on the statement that the essential purpose of the user interface is to enable the user and the system to exchange messages. Provide two examples.
-
Some of the account balances of Mali Company at December 31, 20x0 are shown below: 6% Preferred Stock ($100 par, 2,000 shares authorized) ... $ 20,000 PCIEP, Preferred .................. 3,000 Common...
-
A circuit is comprised of a 1 volt DC voltage source, and two 1k resistors in series. The voltage across each resistor is theoretically 0.5 volts. a. If a voltmeter is used with internal resistance...
-
Read the case XYZ Company: An Integrated Capital Budgeting Instructional Case and answer the following question: Should the replacement asset be purchased? That is, does it make economic (financial)...
-
Selected accounts from Westeros Company's adjusted trial balance for the year ended December 31 follow. $ 45,800 Depreciation expense 950 salaries expense 4,900 Amortization expense $ 9, 500 19,e00...
-
How to model qualitative factors with more than two categories (similar to region of the country), and how to interpret the resulting model, giving an example.
-
Explain why the linear probability model exhibits heteroskedasticity.
-
How to interpret the coefficient on an indicator variable in a log-linear equation.
-
How to estimate and interpret a regression with an indicator dependent variable.
-
How to include a product of two indicator variables in a regression, and how this affects model interpretation, giving an example.
-
(4) Circle the correct answer or fill in the blanks. (You do not have to give explanations.) (a) Is set of vectors (8,2 sinr, 4 cosx} linearly independent? Circle YES or NO. (b) Is W is a subspace of...
-
Suppose that you are part of a virtual team and must persuade other team members on an important matter (such as switching suppliers or altering the project deadline). Assuming that you cannot visit...
-
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...
-
The government regularly publishes many different economic statistics, such as the unemployment rate, the inflation rate, and the surplus or deficit in the federal budget. Study recent newspapers and...
-
Prove that the dual function of Eq. (16.12) is concave Data From Equation (16.12) 19S See https://www.gams.com/ 20 See http://cvxr.com/
-
Consider the quadratic programming problem. min x+x s.t. 1x2 = 4. x1
Study smarter with the SolutionInn App