The purpose of this lab exercise is to familiarize you with simple arithmetic, relational, and if/else...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The purpose of this lab exercise is to familiarize you with simple arithmetic, relational, and if/else operations and the creation of a simple GUI interface involving Button and TextField components. The objectives of this lab are: To create a window form with some of the basic GUI Components. This lab introduces the new JComboBox component. To give additional practice using the nested if, if-elsecontrol structures To introduce the ideas of data validation and object integrity Prerequisites Read Chapter 5 of Java, Java, Java, 3E and read through this document. Read tutorials of Java and Swing components: Java Tutorial on Javatpoint Java Swing tutorial JComboBox tutorial Submission Method Submit the code/answer/solution under your folder in class storage, e.g., /your_name/lab1, /your_name/lab2, ....... The months of the year can contain 28, 30, or 31 days. In the months preceding August (the 8th month), the odd numbered months contain 31 days and even numbered months contains 30 days, except for February (the 2nd month), which has 28 days. Beginning in August, however, the even numbered months contain 31 days and the odd numbered months 30 days. Example: September (the 9th month) has 30 days, while December (the 12th month) has 31 days. Implement a Java GUI application that prompts the user to enter a number which represents a month of the year, and reports whether that month contains 28, 30, or 31 days. Create a Java project called Lab7 first. Step 1. Problem Statement You need to develop a Java GUI application to solve the Days of Month problem and validates user input. Step 2: Problem Decomposition This program should be broken into two classes: Days and DaysGUI. DaysGUI will serve as a user interface. It will prompt the user for day, month, and year. Then pass the month and year to static methods in the Days class, which detemine the leap year or not or the number of days in the month. You will be provided with incomplete versions of both of these classes. This problem can be divided into two classes. The DaysGUI class will display the following window form: DaysGUI class: creates the window form. This class has the following instance variables: o JLa bel lbl Da te txtDay Days in Month GUI applical Enter the date: IblDate cbbMonth JTextField txtDay JComboBox cbbMonth btnReport Fig. 7.1: The GUI of DaysGUI Month Report txtReport txtYear X o JTextField txtYear o JButton btnReport JTextArea txt Report Also, this class has the following public methods: DaysGUI(): constructor method that set the form display properties, initialize the GUI components and set up the event handler o main(): Create the instance of the DaysGUI() that show the window form O O o action Performed(ActionEvent arg0): handle the events that buttons on the form are clicked O keyPressed(KeyEvent arg0): handle the events that key was pressed on the textboxes on the form O o report(): this method checks the leap year and how many days in the month and reports in the text area Days class: this is an utiity class to check leap year and determine the number of days in the month. The Day class is modeled after the Math class. It is declared final, which means that it cannot be extended (subclassed). And its constructor is declared private, which means that this class cannot be instantiated. Also, this class has the following public static methods: O public static boolean isLeap Year(int year): This public static method takes a single int parameter (year) and returns true if the year is leap. Note: A year is a leap year: if it is evenly divisible by 400, or if it is evenly divisible by 4 but not evenly divisible by 100 at the same time. So 1996 was a leap year. But 1900 was not a leap year because, although it is divisible by 4, it is also divisible by 100 and not by 400. 2000 is a leap year because it is divisible by 400. O public static int howManyDays (int month, int year): This public static method takes two int parameters (month and year) and returns the number of days in the month. The input year is used to check for the leap year in case the month is February. Since is LeapYear () and howManyDays () are defined as static, it is known as a class method (rather than an instance method). It is associated with the Days class itself rather than with any of its instances. Thus, to invoke this method (in a print statement), you would use the following reference: System.out.println("There are + Days.howManyDays (6) + 11 Step 3: Problem Design 11 days") This is similar to the way you would invoke the Math.sqrt(25) method. Note: It is not necessary to instantiate Days in DaysGUI. Draw a UML class diagram to describe the design of the Days and DaysGUI classes. Your design should identify the of the class, its attributes (instance variables) and behaviors (methods). Designate which elements will be hidden and which parts of the class will make up its public interface. Note: you don't need to submit this UML. Step 4: Problem Implementation Similar to Lab3, We will use the stepwise refinement approach that we practiced last time to code and test the Days and DaysGUI classes. Create a Eclipse project named Lab7, and saving the project on your workspace. 4.1 Implement the Days class Then, create the Days class in Eclipse. Here's a sequence of appropriate steps: 1. Modify the generated code by Eclipse using the following starter code: public final class Days { // FINAL CLASS CAN'T BE EXTENDED /* this method returns true the year is a leap year */ public static boolean isLeap Year (int year) { //TODO: Implement the code of this method below } /* this method returns how many days in the month in such a year */ public static int howManyDays (int month, int year) { //TODO: Implement the code of this method below } } // end of Days class 2. Type the class design specification in the comment block of this class. 3. public static boolean isLeapYear(int year): This public static method takes a single int parameter (year) and returns true if the year is leap. Note: A year is a leap year: if it is evenly divisible by 400, or if it is evenly divisible by 4 but not evenly divisible by 100 at the same time. So 1996 was a leap year. But 1900 was not a leap year because, although it is divisible by 4, it is also divisible by 100 and not by 400. 2000 is a leap year because it is divisible by 400. In terms of its algorithm, this method should use an if-else control structure to test whether a year is divisible by 400, by 100, and so on. To determine if an integer is divisible by another integer, you can use the mod operator (%). For example, if N % 100 equals O, then N is divisible by 100. That is, N is divisible by 100 if dividing it by 100 leaves a remainder of O: if (N % 100 0) 4. public static int howManyDays (int month, int year): This public static method takes two int parameters (month and year) and returns the number of days in the month. The input year is used to check for the leap year in case the month is == February. In the months preceding August (the 8th month), the odd numbered months contain 31 days and even numbered months contains 30 days, except for February (the 2nd month), which has 29 days in leap year but 28 days in non-leap year. Beginning in August, however, the even numbered months contain 31 days and the odd numbered months 30 days. Example: September (the 9th month) has 30 days, while December (the 12th month) has 31 days. 4.2 Implement the DaysGUI class 1. Type the DaysGUI class design specification into a Java comment block at the beginning of the DaysGUI.java file. This file will be the file you use for defining the DaysGUI class. Here's an example format that you can use: /** * Class Name: DaysGUI * Author: * Date: *Role: The role/purpose of this class * Problem Description: that defines your application - * include name of the project and reason for the development work. Elaborate as you see fit - keeping the scope manageable (2 - 3 sentences) * Goals of your application: State in a way so the end user knows * what your software can do (can be used as). * Enumerate all the inputs and outputs for your application (provide examples) * List all the java packages that need to be imported - * tools that will be needed for solving/coding the problem. Describe specifically your input and output screen formats a brief sketch is an excellent starting point. * * */ 2. Modify the class header as the following code: } public class DaysGUI extends JFrame { //TODO: add code of this class below 3. Import the required Java packages like below: import java.awt. FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JTextField; 4. Declare the following instance variables of this class: private JLabel lblDate; //show "Enter the date: " private JTextField txtDay; //text box to enter the day private JComboBox cbbMonth; //combo box to select month private JTextField txtYear; //text box to enter the year private JButton btnReport; //button "Report" private JTextArea txt Report; //text box to show report. 5. Code the declarations of the constructor method: public DaysGUI () { //1. set the title of the GUI using the setTitle() method //2. set the default close operation: setDefaultCloseOperation (EXIT_ON_CLOSE); //3. set the size of the form: setSize(350, 250); //4. set the layout: setLayout (new FlowLayout()); //5. create the instance lblDate //6. create the instance txtDay with 4 columns //7. create the instance of string array named months // String[] months // { "Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; } // // //8. create the combobox cbbMonth // cbbMonth = new JComboBox (months); //9. create the instance txtYear with 5 columns //10. create the button btnReport with the text "Report" //11. create the text area txtReport with 7 rows and 25 columns //12. make the text area txtReport not editable by calling txtReport.setEditab //13. add all components to the form by calling the add() method like below: // add (lblDate); // do the same as previous line for the other components: // txtDay, cbbMonth, txtYear, btnReport, txtReport //14. make the form visible by calling setVisible with argument true //add this class as the action listener of btnReport btnReport.addActionListener(this); //add this class as the key listener of txtYear txtYear.addKeyListener(this); } 6. Add code to the main method to create and use one DaysGUI object. Below is the code for this main method: public static void main(String[] args) { new DaysGUI (); Step 5: Handling Events and Implementing Required Methods 5.1 Handle Events (Button Clicked) on DaysGUI Now we need to handle the events when the buttons are clicked on the form and ENTER key was pressed on the text box "Year". 1. Modify the class header to add the implementation of ActionListener and KeyListener as the following code: public class DaysGUI extends JFrame implements ActionListener, KeyListener { //... the current code of the class } 2. Code the action Performed (ActionEvent e) method to handle the click events on buttons using the the following steps (some code are already provided, some need to be completed (marked by TODO)) public void action Performed ( ActionEvent e) { //if e.getSource() equals to btnReport => btnReport was clicked if (e.getSource() } } } btnReport) { //TODO: call the report() method 3. Code the keyPressed (KeyEvent e) method to handle the key events using the following steps (some code are already provided, some need to be completed (marked by TODO)) public void keyPressed (KeyEvent e) { //if e.getSource() equals to txtYear => key was pressed on the txtYe if (e.getSource() txtYear) { // if e.getKeyCode () equals to KeyEvent. VK_ENTER, that means ENTER key was if(e.getKeyCode () KeyEvent.VK_ENTER) { //TODO: call the report() method } == } == 5.2 Implement the other methods == // copy the following code public void keyReleased (KeyEvent arg0) { } public void keyTyped (KeyEvent arg0) { } Now we need to handle the events when the buttons are clicked on the form. 1. Implement the report () method (by completing the code with the instructions in the comments, some are already completed): public void report() { //1. TODO: clear the text in the txtReport by using setText() with empty strir //2. declare a String variable named yearStr = the text in the txtYear String yearStr = txtYear.getText(); //3. check the leap year try { } } //TODO: 4. declare an integer year = parse integer from yearStr //5. declare a boolean variable isLeap Year = Days.isLeapYear(year) //boolean is LeapYear = Days.is LeapYear (year); //6. check if isLeapYear is true if(isLeapYear) { //7. append the text in txtYear + is leap year " to txtReport //txtReport.append(txtYear.getText() + is leap year "); } } else { //8. TODO: similar to 7, append txtYear.getText() + 11 } //report the days in the selected month //9. int month = get the selected month in cbbMonth //int month = cbbMonth.getSelectedIndex(); //10. check if month is greater than and less than or equals to 12 if(month> 0 && month method descriptions, inputs / outputs of methods, pseudocode if any. Also, try to add comment inside the method body. Step 6: Test the GUI of the DaysGUI application Run this GUI program and capture the screenshots of the outputs of your program. Here are sample outputs of this part (Note: your output in submitted pdf file must be as the same as the sample output): Days in Month GUI applica... Enter the date: 25 1992 is a leap year February has 29 days User has entered 25 February Enter the date: 25 Report Days in Month GUI applica... Month Report 1992 is a leap year You haven't selected the month User has entered 25 1992 1992 X Days in Month GUI applica... Enter the date: abc aaa is not a valid year abc is not a valid day Enter the date: abc Report Days in Month GUI applica... Month 1990 is not a leap year June has 30 days abc is not a valid day Requirements June Report 4 aaa Submission You need to submit the following results: Note: for each lab or assignment, you must write comment block (at the top of .java file) and comments for all variables and all methods for each .java file you create. 1990 1. Capture the outputs using screenshots for your program in step 6. Write them into a pdf file named result.pdf. 2. Source code: Submit the exported project Lab7 folder (DO NOT compress it into .zip) to your /your_name/lab7 folder in your class storage. Write your own code. Write the clean code. Your submitted code should be run successfully without any syntax errors. Your code can correctly solve the problem in the lab description, and meanwhile do not add unnecessary lines of code that are not required in the lab description. Your code can output the correct results. Grading Your code follows good coding style, e.g., proper indention, reasonable variable/method/class names, necessary comments, etc. Export the lab code as a project from the Eclipse in your computer. Include all necessary files and use relative path instead of absolute path to ensure your code can be run successfully without much configuration when your code is checked for grading. Submit the lab before the deadline. Implement the correct solution to the problem in the lab description with correct output results. (40%) Define necessary variable/method/class correctly without any errors. (30%) Practice good coding style. (10%) Provide brief and helpful description of the idea at the top of the file and necessary and reasonable comments in the body. (10%) Meet all the requirements. (10%) The purpose of this lab exercise is to familiarize you with simple arithmetic, relational, and if/else operations and the creation of a simple GUI interface involving Button and TextField components. The objectives of this lab are: To create a window form with some of the basic GUI Components. This lab introduces the new JComboBox component. To give additional practice using the nested if, if-elsecontrol structures To introduce the ideas of data validation and object integrity Prerequisites Read Chapter 5 of Java, Java, Java, 3E and read through this document. Read tutorials of Java and Swing components: Java Tutorial on Javatpoint Java Swing tutorial JComboBox tutorial Submission Method Submit the code/answer/solution under your folder in class storage, e.g., /your_name/lab1, /your_name/lab2, ....... The months of the year can contain 28, 30, or 31 days. In the months preceding August (the 8th month), the odd numbered months contain 31 days and even numbered months contains 30 days, except for February (the 2nd month), which has 28 days. Beginning in August, however, the even numbered months contain 31 days and the odd numbered months 30 days. Example: September (the 9th month) has 30 days, while December (the 12th month) has 31 days. Implement a Java GUI application that prompts the user to enter a number which represents a month of the year, and reports whether that month contains 28, 30, or 31 days. Create a Java project called Lab7 first. Step 1. Problem Statement You need to develop a Java GUI application to solve the Days of Month problem and validates user input. Step 2: Problem Decomposition This program should be broken into two classes: Days and DaysGUI. DaysGUI will serve as a user interface. It will prompt the user for day, month, and year. Then pass the month and year to static methods in the Days class, which detemine the leap year or not or the number of days in the month. You will be provided with incomplete versions of both of these classes. This problem can be divided into two classes. The DaysGUI class will display the following window form: DaysGUI class: creates the window form. This class has the following instance variables: o JLa bel lbl Da te txtDay Days in Month GUI applical Enter the date: IblDate cbbMonth JTextField txtDay JComboBox cbbMonth btnReport Fig. 7.1: The GUI of DaysGUI Month Report txtReport txtYear X o JTextField txtYear o JButton btnReport JTextArea txt Report Also, this class has the following public methods: DaysGUI(): constructor method that set the form display properties, initialize the GUI components and set up the event handler o main(): Create the instance of the DaysGUI() that show the window form O O o action Performed(ActionEvent arg0): handle the events that buttons on the form are clicked O keyPressed(KeyEvent arg0): handle the events that key was pressed on the textboxes on the form O o report(): this method checks the leap year and how many days in the month and reports in the text area Days class: this is an utiity class to check leap year and determine the number of days in the month. The Day class is modeled after the Math class. It is declared final, which means that it cannot be extended (subclassed). And its constructor is declared private, which means that this class cannot be instantiated. Also, this class has the following public static methods: O public static boolean isLeap Year(int year): This public static method takes a single int parameter (year) and returns true if the year is leap. Note: A year is a leap year: if it is evenly divisible by 400, or if it is evenly divisible by 4 but not evenly divisible by 100 at the same time. So 1996 was a leap year. But 1900 was not a leap year because, although it is divisible by 4, it is also divisible by 100 and not by 400. 2000 is a leap year because it is divisible by 400. O public static int howManyDays (int month, int year): This public static method takes two int parameters (month and year) and returns the number of days in the month. The input year is used to check for the leap year in case the month is February. Since is LeapYear () and howManyDays () are defined as static, it is known as a class method (rather than an instance method). It is associated with the Days class itself rather than with any of its instances. Thus, to invoke this method (in a print statement), you would use the following reference: System.out.println("There are + Days.howManyDays (6) + 11 Step 3: Problem Design 11 days") This is similar to the way you would invoke the Math.sqrt(25) method. Note: It is not necessary to instantiate Days in DaysGUI. Draw a UML class diagram to describe the design of the Days and DaysGUI classes. Your design should identify the of the class, its attributes (instance variables) and behaviors (methods). Designate which elements will be hidden and which parts of the class will make up its public interface. Note: you don't need to submit this UML. Step 4: Problem Implementation Similar to Lab3, We will use the stepwise refinement approach that we practiced last time to code and test the Days and DaysGUI classes. Create a Eclipse project named Lab7, and saving the project on your workspace. 4.1 Implement the Days class Then, create the Days class in Eclipse. Here's a sequence of appropriate steps: 1. Modify the generated code by Eclipse using the following starter code: public final class Days { // FINAL CLASS CAN'T BE EXTENDED /* this method returns true the year is a leap year */ public static boolean isLeap Year (int year) { //TODO: Implement the code of this method below } /* this method returns how many days in the month in such a year */ public static int howManyDays (int month, int year) { //TODO: Implement the code of this method below } } // end of Days class 2. Type the class design specification in the comment block of this class. 3. public static boolean isLeapYear(int year): This public static method takes a single int parameter (year) and returns true if the year is leap. Note: A year is a leap year: if it is evenly divisible by 400, or if it is evenly divisible by 4 but not evenly divisible by 100 at the same time. So 1996 was a leap year. But 1900 was not a leap year because, although it is divisible by 4, it is also divisible by 100 and not by 400. 2000 is a leap year because it is divisible by 400. In terms of its algorithm, this method should use an if-else control structure to test whether a year is divisible by 400, by 100, and so on. To determine if an integer is divisible by another integer, you can use the mod operator (%). For example, if N % 100 equals O, then N is divisible by 100. That is, N is divisible by 100 if dividing it by 100 leaves a remainder of O: if (N % 100 0) 4. public static int howManyDays (int month, int year): This public static method takes two int parameters (month and year) and returns the number of days in the month. The input year is used to check for the leap year in case the month is == February. In the months preceding August (the 8th month), the odd numbered months contain 31 days and even numbered months contains 30 days, except for February (the 2nd month), which has 29 days in leap year but 28 days in non-leap year. Beginning in August, however, the even numbered months contain 31 days and the odd numbered months 30 days. Example: September (the 9th month) has 30 days, while December (the 12th month) has 31 days. 4.2 Implement the DaysGUI class 1. Type the DaysGUI class design specification into a Java comment block at the beginning of the DaysGUI.java file. This file will be the file you use for defining the DaysGUI class. Here's an example format that you can use: /** * Class Name: DaysGUI * Author: * Date: *Role: The role/purpose of this class * Problem Description: that defines your application - * include name of the project and reason for the development work. Elaborate as you see fit - keeping the scope manageable (2 - 3 sentences) * Goals of your application: State in a way so the end user knows * what your software can do (can be used as). * Enumerate all the inputs and outputs for your application (provide examples) * List all the java packages that need to be imported - * tools that will be needed for solving/coding the problem. Describe specifically your input and output screen formats a brief sketch is an excellent starting point. * * */ 2. Modify the class header as the following code: } public class DaysGUI extends JFrame { //TODO: add code of this class below 3. Import the required Java packages like below: import java.awt. FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JTextField; 4. Declare the following instance variables of this class: private JLabel lblDate; //show "Enter the date: " private JTextField txtDay; //text box to enter the day private JComboBox cbbMonth; //combo box to select month private JTextField txtYear; //text box to enter the year private JButton btnReport; //button "Report" private JTextArea txt Report; //text box to show report. 5. Code the declarations of the constructor method: public DaysGUI () { //1. set the title of the GUI using the setTitle() method //2. set the default close operation: setDefaultCloseOperation (EXIT_ON_CLOSE); //3. set the size of the form: setSize(350, 250); //4. set the layout: setLayout (new FlowLayout()); //5. create the instance lblDate //6. create the instance txtDay with 4 columns //7. create the instance of string array named months // String[] months // { "Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; } // // //8. create the combobox cbbMonth // cbbMonth = new JComboBox (months); //9. create the instance txtYear with 5 columns //10. create the button btnReport with the text "Report" //11. create the text area txtReport with 7 rows and 25 columns //12. make the text area txtReport not editable by calling txtReport.setEditab //13. add all components to the form by calling the add() method like below: // add (lblDate); // do the same as previous line for the other components: // txtDay, cbbMonth, txtYear, btnReport, txtReport //14. make the form visible by calling setVisible with argument true //add this class as the action listener of btnReport btnReport.addActionListener(this); //add this class as the key listener of txtYear txtYear.addKeyListener(this); } 6. Add code to the main method to create and use one DaysGUI object. Below is the code for this main method: public static void main(String[] args) { new DaysGUI (); Step 5: Handling Events and Implementing Required Methods 5.1 Handle Events (Button Clicked) on DaysGUI Now we need to handle the events when the buttons are clicked on the form and ENTER key was pressed on the text box "Year". 1. Modify the class header to add the implementation of ActionListener and KeyListener as the following code: public class DaysGUI extends JFrame implements ActionListener, KeyListener { //... the current code of the class } 2. Code the action Performed (ActionEvent e) method to handle the click events on buttons using the the following steps (some code are already provided, some need to be completed (marked by TODO)) public void action Performed ( ActionEvent e) { //if e.getSource() equals to btnReport => btnReport was clicked if (e.getSource() } } } btnReport) { //TODO: call the report() method 3. Code the keyPressed (KeyEvent e) method to handle the key events using the following steps (some code are already provided, some need to be completed (marked by TODO)) public void keyPressed (KeyEvent e) { //if e.getSource() equals to txtYear => key was pressed on the txtYe if (e.getSource() txtYear) { // if e.getKeyCode () equals to KeyEvent. VK_ENTER, that means ENTER key was if(e.getKeyCode () KeyEvent.VK_ENTER) { //TODO: call the report() method } == } == 5.2 Implement the other methods == // copy the following code public void keyReleased (KeyEvent arg0) { } public void keyTyped (KeyEvent arg0) { } Now we need to handle the events when the buttons are clicked on the form. 1. Implement the report () method (by completing the code with the instructions in the comments, some are already completed): public void report() { //1. TODO: clear the text in the txtReport by using setText() with empty strir //2. declare a String variable named yearStr = the text in the txtYear String yearStr = txtYear.getText(); //3. check the leap year try { } } //TODO: 4. declare an integer year = parse integer from yearStr //5. declare a boolean variable isLeap Year = Days.isLeapYear(year) //boolean is LeapYear = Days.is LeapYear (year); //6. check if isLeapYear is true if(isLeapYear) { //7. append the text in txtYear + is leap year " to txtReport //txtReport.append(txtYear.getText() + is leap year "); } } else { //8. TODO: similar to 7, append txtYear.getText() + 11 } //report the days in the selected month //9. int month = get the selected month in cbbMonth //int month = cbbMonth.getSelectedIndex(); //10. check if month is greater than and less than or equals to 12 if(month> 0 && month method descriptions, inputs / outputs of methods, pseudocode if any. Also, try to add comment inside the method body. Step 6: Test the GUI of the DaysGUI application Run this GUI program and capture the screenshots of the outputs of your program. Here are sample outputs of this part (Note: your output in submitted pdf file must be as the same as the sample output): Days in Month GUI applica... Enter the date: 25 1992 is a leap year February has 29 days User has entered 25 February Enter the date: 25 Report Days in Month GUI applica... Month Report 1992 is a leap year You haven't selected the month User has entered 25 1992 1992 X Days in Month GUI applica... Enter the date: abc aaa is not a valid year abc is not a valid day Enter the date: abc Report Days in Month GUI applica... Month 1990 is not a leap year June has 30 days abc is not a valid day Requirements June Report 4 aaa Submission You need to submit the following results: Note: for each lab or assignment, you must write comment block (at the top of .java file) and comments for all variables and all methods for each .java file you create. 1990 1. Capture the outputs using screenshots for your program in step 6. Write them into a pdf file named result.pdf. 2. Source code: Submit the exported project Lab7 folder (DO NOT compress it into .zip) to your /your_name/lab7 folder in your class storage. Write your own code. Write the clean code. Your submitted code should be run successfully without any syntax errors. Your code can correctly solve the problem in the lab description, and meanwhile do not add unnecessary lines of code that are not required in the lab description. Your code can output the correct results. Grading Your code follows good coding style, e.g., proper indention, reasonable variable/method/class names, necessary comments, etc. Export the lab code as a project from the Eclipse in your computer. Include all necessary files and use relative path instead of absolute path to ensure your code can be run successfully without much configuration when your code is checked for grading. Submit the lab before the deadline. Implement the correct solution to the problem in the lab description with correct output results. (40%) Define necessary variable/method/class correctly without any errors. (30%) Practice good coding style. (10%) Provide brief and helpful description of the idea at the top of the file and necessary and reasonable comments in the body. (10%) Meet all the requirements. (10%)
Expert Answer:
Answer rating: 100% (QA)
Heres a Java code that implements the Days of Month problem using a GUI java import javaxswing impor... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a literature review for your study. See below for an example of a literature review. Your literature review should provide both analysis and synthesis of previous studies as related to the...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Does the customer buying process end when a customer buys some merchandise? Explain your answer.
-
Prepare a set of summarized journal entries for all October 2017 transactions affecting Work in Process- Assembly. Set up a T-account for Work in Process-Assembly and post your entries to it....
-
Find the centroid of the triangular region cut from the first quadrant by the line x + y = 3.
-
What does argv provide to our program?
-
Depreciation and Cash Flow Ohare Companys only asset as of January 1, 2010, was a limousine. During 2010, only the following three transactions occurred: Services of $100,000 were provided on...
-
RELATIONAL DATABASE CONCEPTS: Describe the basic steps required to install the Oracle, SQL Server, and MySQL relational database management systems (RDBMSs) and the major challenges that the user may...
-
Draw a truth table for the circuit in Figure P2.40 and explain what it does. FIGURE P2.30 A B P R C
-
Note: Some data input to this program and some program output depends on your name. If you do not use your name as required, points will be deducted for this assignment. One of the most popular New...
-
Simplify the following expression by expanding and collecting like terms. 10(-3)+6(-8x+3) Give your answer in the form az + b.
-
Journalize Period Payroll The payroll register of Chen Engineering Co. indicates $2,220 of social security withheld and $555 of Medicare tax withheld on total salaries of $37,000 for the period....
-
Rhett Corporation manufactures and sells dress shirts. Each shirt (unit) requires 2 yards of cloth. Selected data from Rhett's master budget for next quarter are shown below: April May June Budgeted...
-
Find log5,log4, and log20. Show that log20=log5+log4. What property of logarithms does this equality illustrate? What property of exponentiation does this property come from?
-
The actual cost of direct labor per hour is $8.00, and the budgeted cost of direct labor per hoour is $7.50. Three budgeted direct labor hours are allowed for each finished unit. During the current...
-
Your cat "Ms." (mass 8.50 kg ) is trying to make it to the top of a frictionless ramp 2.00 m long and inclined 19.0 above the horizontal. Since the poor cat can't get any traction on the ramp, you...
-
2. In the circuit given in Figure 2, i,(t) = 5.67cos(5t)A and v (t) = 70.71 cos(5t 60) V a) Find the equivalent load impedance. State whether the load is inductive or capacitive. b) Calculate the...
-
Pick three of the possible problems with meta-analysis listed in Section 25.4, and discuss how they might apply to the reviews in the Cochrane Database.
-
An advertisement for SeldaneD, a (now discontinued) drug prescribed for seasonal allergic rhinitis, reported results of a double-blinda study in which 374 patients took Seldane-D and 193 took a...
-
Design and carry out a study to test the proposition that men have lower resting pulse rates than women.
-
What might be problematic about these responses to interview questions? How might the answers be improved? a. Q: Tell me about yourself. A: Im really easy-going and casual. b. Q: I noticed that you...
-
Revise the follow-up message below to be more professional and effective, based on the principles in this chapter. December 2, 2021 Ms. Charlotte LeClaire Pebble Creek Publishing Inc. New York, NY...
-
Write a follow-up email message or letter after an office visit or plant trip. Thank your hosts for their hospitality; relate your strong points to things you learned about the company during the...
Study smarter with the SolutionInn App