Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make the attached screen or GUI work. They must apply Exception Handling for this program (DayOfWeek and DayOfWeekDriver) DayOfWeek.java: package edu.pupr.DayOfWeek; import java.util.Scanner; import java.util.InputMismatchException;

Make the attached screen or GUI work.

They must apply Exception Handling for this program (DayOfWeek and DayOfWeekDriver)

DayOfWeek.java:

package edu.pupr.DayOfWeek;

import java.util.Scanner; import java.util.InputMismatchException; //public class public class DayOfWee { // find day of week static void findweek(int day, int month, int year) { // January month if (month == 1) { month = 13; year--; } // February month if (month == 2) { month = 14; year--; }

int q = day; int m = month; int k = year % 100; int j = year / 100;

int h = (q + 26 * ( m + 1) / 10 + k + k / 4 + j / 4 + 5 * j) % 7; System.out.print("The Day is : "); //switch and case based on the birthday switch (h) { case 0 : System.out.println("Saturday"); break; case 1 : System.out.println("Sunday"); break; case 2 : System.out.println("Monday"); break; case 3 : System.out.println("Tuesday"); break; case 4 : System.out.println("Wednesday"); break; case 5 : System.out.println("Thursday"); break; case 6 : System.out.println("Friday"); break; } } //Public void for the ask function public void ask() { Scanner scan = new Scanner(System.in); int day = 0 ; int month = 0 ; int year = 0 ; // Exception handling try { System.out.print("Enter day: "); day = scan.nextInt(); if(day < 1 || day > 31) { System.out.println("Day not valid"); System.exit(0); } System.out.print("Enter a month: "); month = scan.nextInt(); if(month < 1 || month > 12) { System.out.println("Month not valid"); System.exit(0); } System.out.print("Enter year: "); year = scan.nextInt(); } catch(InputMismatchException e) { System.out.println("Argument not valid"); System.exit(0); } } //public void for the show function public void show() { int day = 0 ; int month = 0 ; int year = 0 ; findweek(day,month,year); } }

DayOfWeekDriver.java:

package edu.pupr.DayOfWee;

public class DayOfWeeDriver { public static void main(String[] args) { // Using Scanner for Getting Input from User DayOfWee in = new DayOfWee(); in.ask(); in.show(); } }

This must contain a GUI along with an exception handling. This must be done in eclipse using Java

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

=+What can I do to make this press worthy?

Answered: 1 week ago

Question

4. What decision would you make and why?

Answered: 1 week ago

Question

3. Review the evidence. Do you believe the testimony presented?

Answered: 1 week ago