Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble with my java coding assignment and can't quite figure out where to go. I have most of it done but if

I am having trouble with my java coding assignment and can't quite figure out where to go. I have most of it done but if someone could create this so I have something to reference I would greatly appreciate it.image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Tools View CSCI 1010 Programming Assignment 3 - Word CSCI 1010 - Programming Assignment 3 Learning Outcomes Develop a menu-based interface using control structures. Use switch statements with integers, characters, and strings. Write code that repeatedly performs actions using while, do-while and for statements. Use boolean variables as conditions for branching statements and loops. Required Reading Savitch - Sections 3.2-3.4, 4.1-4.2 Instructions For this assignment you must write a program that displays a calendar month in the following format: Screen 1 of 9 + 14096 Type here to search O P] 8:37 PM 3/5/2021 File Tools View CSCI 1010 Programming Assignment 3 - Word MAR 2021 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Your program should do the following: 1. Display a welcome message with your name. 2. Prompt the user for the year. If the year is not between 1753 and 9999, display an error and exit the program. 3. Use an if-else statement to determine if the year is a leap year. Use a boolean variable to represent if the year is a leap year. If the year is a multiple of 400, it is a leap year. Otherwise, if the year is a multiple of 100, it is not a leap year. . Otherwise, if the year is a multiple of 4, it is a leap year. Otherwise, it is not a leap year. Screen 2 of 9 E + 14096 Type here to search P] la x 8:38 PM 3/5/2021 File Tools View CSCI 1010 Programming Assignment 3 - Word 4. Prompt the user for a three-letter month abbreviation. 5. Use a switch statement to determine if the month is valid and how many days it has. Convert the month to upper case before using it as the controlling expression of the switch statement. If the month is JAN, MAR, MAY, JUL, AUG, OCT, or DEC it has 31 days. If the month is APR, JUN, SEP, or NOV it has 30 days. If the month is FEB then it has 29 days if the year is a leap year and 28 days otherwise. If the month is any other value, display an error and exit the program. 6. Prompt the user for a three-letter day abbreviation of the day the month starts on. 7. Use a switch statement to determine if the day is valid and what its position in the week is. Convert the day to upper case before using it as the controlling expression of the switch statement. If the day is SUN, its position is 0. If the day is MON, its position is 1. If the day is TUE, its position is 2. If the day is WED, its position is 3. If the day is THU, its position is 4. If the day is FRI, its position is 5. If the day is SAT, its position is 6. Screen 3 of 9 E + 14096 Type here to search O wi P] 8:39 PM 3/5/2021 File Tools View CSCI 1010 Programming Assignment 3 - Word If the day is any other value, display an error and exit the program. 8. Display the heading for the calendar. The first line should contain the month name and the year. The second line should contain 2-letter abbreviations of each day, with a space before each one. 9. Display the days in the calendar. Create a variable to represent the dates you will display and initialize it to 1 minus the day position you calculated in Step 7. Use a while statement to repeatedly display the rows of the calendar until the date variable is greater than the number of days. Inside the while statment, use a for statement to display each entry as follows: o If the date variable is less than one or greater than the number of days, display a blank entry (three spaces). o Otherwise, display the date so it will fill 3 characters of space. o Increment the date. After each row is displayed, make sure to go to the next line. 10. Ask the user if they want to display another month. If they do, go back to Step 2. Use a do-while statement for the main loop in the program. 11. If the user does not want to display another month, exit the loop and display a thank-you message. Screen 4 of 9 ET + 14096 Type here to search O P] 8:40 PM 3/5/2021 File Tools View CSCI 1010 Programming Assignment 3 - Word Example Input and Output When you test your program the output should look like the following examples: Example Run 1: Welcome to Napoleon Bonaparte's calendar program! Please enter a year between 1753 and 9999 8 Invalid year Example Run 2: Welcome to Napoleon Bonaparte's calendar program! Please enter a year between 1753 and 9999 1799 Please choose a month (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) Brumaire Invalid Month Example Run 3: Welcome to Napoleon Bonaparte's calendar program! Screen 5 of 9 ES No new notifications 8:40 PM 3/5/2021 Type here to search O wi P] la x File Tools View CSCI 1010 Programming Assignment 3 - Word Please enter a year between 1753 and 9999 1799 Please choose a month (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) Nov Please enter the day that the month starts on (Sun Mon Tue Wed Thu Fri Sat) Primidi Invalid Day Example Run 4: Welcome to Napoleon Bonaparte's calendar program! Please enter a year between 1753 and 9999 1799 Please choose a month (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) Nov Please enter the day that the month starts on (Sun Mon Tue Wed Thu Fri Sat) Sat NOV 1799 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Screen 6 of ||| Els + 140% File Tools View CSCI 1010 Programming Assignment 3 - Word - 23 24 25 26 27 28 29 30 Would you like to display another calendar month? (Yes/No) Yes Please enter a year between 1753 and 9999 2021 Please choose a month (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) Feb Please enter the day that the month starts on (Sun Mon Tue Wed Thu Fri Sat) Mon FEB 2021 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Would you like to display another calendar month? (Yes/No) Yes Screen 7 of 9 EE + 14096 Type here to search O . w] P] a 8:41 PM 3/5/2021 O File Tools View CSCI 1010 Programming Assignment 3 - Word Please enter a year between 1753 and 9999 2020 Please choose a month (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) Feb Please enter the day that the month starts on (Sun Mon Tue Wed Thu Fri Sat) Sat FEB 2020 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Would you like to display another calendar month? (Yes/No) No Thank you for using Napoleon Bonaparte's calendar program! Screen 8 of 9 E + 14096 HE Type here to search O wi P] la x 8:42 PM 3/5/2021 File Tools View CSCI 1010 Programming Assignment 3 - Word Notes and Comments Upload your Java source files to the dropbox named Programming Assignment 3. The name of the source file for the main class must be your name followed by Program with the extension .java. Make sure to include comments with your name, a description of what the program does, the course (CSCI 1010), and the assignment name (Programming Assignment 3) at the beginning of all of your source files. Also make sure to add comments at the beginning of each of the methods you write describing what they do. Make sure you only hand in the source files for your assignment, not the class files, or any other files that NetBeans cre- ates. Your programs must compile without errors in order to be graded. Once your program compiles make sure to test it us- ing multiple test cases to see if it meets the requirements of the assignment. End of document Screen 99 + 14096 HE Type here to search O P] la x 8:43 PM 3/5/2021

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

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago