Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Question 1 Write a program that given a number from 1 to 7 outputs what day of the week it corresponds to (1-Monday, 7

JAVA
image text in transcribed
image text in transcribed
Question 1 Write a program that given a number from 1 to 7 outputs what day of the week it corresponds to (1-Monday, 7 = Sunday) and whether it is a weekday or weekend. You may assume an integer as input but if the input is not from 1 to 7, you should output that it's not a valid day. Write two versions of this program: Version 1: Use an if/else statement Version 2: Use a Switch statement (instead of an if/else) Here are a few sample outputs to illustrate the expected behavior of your program. Note: user input is highlighted in grey Please enter the day of the week as a number (1-7): 7 It's Sunday! It's the weekend! Please enter the day of the week as a number (1-7): 5 It's Friday! It's a weekday

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Briefly describe the four types of risk discussed in the chapter.

Answered: 1 week ago

Question

3. Is training key to your companys strategy? Is it proprietary?

Answered: 1 week ago