Question: PLEASE DO NOT COPY PASTE FROM GOOGLE AND CHEGG. Question # 1 Write a Code (in C#) and provide snapshots of your given input and

 PLEASE DO NOT COPY PASTE FROM GOOGLE AND CHEGG. Question #

PLEASE DO NOT COPY PASTE FROM GOOGLE AND CHEGG.

Question # 1 Write a Code (in C#) and provide snapshots of your given input and obtained output. a (a): You need to create an integer array of size 4 to store marks of 4 students. The total marks is 10, that means that the given marks must not be greater than 0. Take user input to enter the elements in an array. The loop for entering elements should run from 1 to 6. . .. You should receive an index out of bound exception. Also, you may receive NumberFormatException when user tries to input String in the Integer array. Also throw an IllegalArgumentException if the input number is greater than 10. (b):- Correct the following code and add appropriate exception handling. To handle exception in an elegant manner, asks user to re-enter data until he enters data in correct format. Also, add a finally block that shows message as follow: o. If try completes successfully, Finally prints The program has been completed successfully o. Finally runs after catch block, prints Finally printsRepeating input from start again? public class NewClass { public static void main(String[] args) { Scanner scan =new Scanner(System.in); int month = Integer.parseInt(JOptionPane.showInputDialog("Enter month as integer")); int day = Integer.parseInt(JOptionPane.showInput Dialog("Enter day as integer")); int year =Integer.parseInt(JOptionPane.showInput Dialog("Enter year as integer")); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date aDate = new Date(dDay+"/"+dMonth+"/"+dYear); System.out.println(dateFormat.format(aDate)); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!