11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com Home Study tools My courses My books Career Life Search Find solutions for your homework Your subscription will expire on Nov 30, 2021. Turn on auto-renew to keep accessing solutions. Turn on auto-renew home / study / engineering / computer science / computer science questions and answers / i. construct a solution algorithm for the following prob… Question: I. Construct a solution algorithm for the following problems. Y… (1 bookmark) I. Construct a solution algorithm for the following problems. Post a question Answers from our experts for your tough homework questions Enter question Your solution should contain: • A defining problem • A pseudo code algorithm Continue to post • A desk check of the algorithm 20 questions remaining 1. An Employee file contains the employee number, employee name, department number and their salary. The department number contains value 10, 20 and 30. Increment for the employee will be calculated depends on their department number. If the department number is 10, 20 and 10 salary increment will be 40%, 60% and 80% respectively. Construct an algorithm that will read a record on the file, calculate the salary increment for that record, and print the employee number, employee name, department number and new salary after increment. 2. A member records contains member name, gender (M or F), age (in years) and marital status (single or married) for each member. Design an algorithm that will read through the file and calculate the numbers of married men, single men, married women and single women. Print these numbers on member summary report. If any single men are over 30 years of age, print their names and ages on a separate eligible bachelors report. 3. Design an algorithm that will prompt for and receive the time expressed in 2400 format (e.g. 2305 hours), convert it to 12-hour format (e.g. 11.05 pm) and display the new time to the screen. Your program is to repeat the processing until a sentinel time of 9999 is entered II. Implement the three questions algorithm in Assignment 1 into Java programming. Your code should contain appropriate validations and must focus on code optimization. You need to submit: • Three Java code Snap a photo from your phone to post a question • For each question explain (100-150 words) how the logic works. • Three sample output screenshot (Two normal and one error test case) We'll send you a one-time download link Expert Answer Anonymous answered this 775 answers 888-888-8888 Was this answer helpful? Hi here is the complete answer, algorithm code and also I've provided file for testing purpose 1 0 Text me By providing your phone number, you agree to receive a one-tim automated text message with a link to get the app. Standard messaging rates may apply. Dont mess up with data arrangement inside file, I've taken values to be separated by comma in file 1. My Textbook Solutions open file Instant access to step-by-step solutions for your textbooks while not End_of_File read a line extract/ split data from line if (employee_number is 10) salary = salary + salary * 0.4 Add a textbook Add a textbook Add a textbook if (employee_number is 20) salary = salary + salary * 0.6 if (employee_number is 30) salary = salary + salary * 0.8 print(employee number, employee name, department_number, salary) Employee.java https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 1/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com Home Study tools My courses My books Career Life DS2.ai | MLOps solution DSLAB GLOBAL Learn More import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Employee { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); System.out.println("Enter filename: "); String fileName = sc.nextLine(); File file = new File(fileName); if(! file.exists()) { System.out.println("File " + fileName + " does not exist"); System.exit(1); } Scanner fileSC = new Scanner(file); while(fileSC.hasNextLine()) { String line = fileSC.nextLine(); String splits[] = line.split(","); double salary = Double.parseDouble(splits[3]); if(splits[0].equals("10")) { salary += salary * 0.4; } if(splits[0].equals("20")) { salary += salary * 0.6; } https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 2/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com if(splits[0].equals("30")) { Home Study tools salary += salary * 0.8; My courses My books Career Life } System.out.println("Employee Number: " + splits[0] + " Name: " + splits[1] + " Department Number: " + splits[2] + " Salary: " + salary); } fileSC.close(); } } employee.txt 10,Bagota,CS122,32000 10,Jack Sparrow,BG122,54000 20,Susti,CS122,34000 30,Friend,CS122,3200 20,Kismi,CS122,43000 30,Mubasa,CS122,23000 .............. 2. married_men = 0, single_men = 0, married_women=0, single_women = 0 eligible_bachelors open file while not End_of_File read a line extract/ split data from line member name, gender (M or F), age (in years) and marital status if (gender is M and marital_status is single) single_men = single_men + 1 if (gender is F and marital_status is single) single_women = single_women + 1 if (gender is M and marital_status is married) married_men = married_men + 1 if (gender is F and marital_status is married) married_women =married_women + 1 if(gender is M and marital_status is single and age > 30) add name in eligible_bachelors print(single_men) print(single_women) print(married_men) print(married_women) print('These are eligible bachelors') print (eligible_bachelors) members.java https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 3/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com Home Study tools My courses My books Career Life import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.ArrayList; public class member { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); System.out.println("Enter filename: "); String fileName = sc.nextLine(); https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 4/8 11/18/21, 7:39 PM File file = new File(fileName); Home Study tools I. Construct A Solution Algorithm For The Followin... | Chegg.com My courses My books Career Life if(! file.exists()) { System.out.println("File " + fileName + " does not exist"); System.exit(1); } Scanner fileSC = new Scanner(file); int single_men = 0, married_men = 0, single_women = 0, married_women= 0; ArrayList<String> bachelors = new ArrayList<String>(); while(fileSC.hasNextLine()) { String line = fileSC.nextLine(); String splits[] = line.split(","); if(splits[1].equals("M") && splits[3].equals("single")) single_men++; if(splits[1].equals("F") && splits[3].equals("single")) single_women++; if(splits[1].equals("M") && splits[3].equals("married")) married_men++; if(splits[1].equals("F") && splits[3].equals("married")) married_women++; int age = Integer.parseInt(splits[2]); if(splits[1].equals("M") && splits[3].equals("single") && age>30) bachelors.add(splits[0] + ", age: " + age); } System.out.println("Single men: " + single_men); System.out.println("Single women: " + single_women); System.out.println("Married men: "+ married_men); System.out.println("Married women: "+ married_women); System.out.println("\nFollowing are eligible bachelors"); for(String s: bachelors) System.out.println(s); } } members.txt Mia,F,32,married Freddy,M,33,married Wick,M,40,single Labina,F,40,single Ashad,M,35,single Jenny,F,23,married ..................... 3. if( time_expressed <0) print('invalid time') return https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 5/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com if(time_expressedHome /100 > 24 || time_expressed > 2400) Study tools My courses print('time cannot be more than 2400 hours') My books Career Life return if(time_expressed % 100 > 59) print('invalid minutes') return if(time_expressed == 2400) twelve_hours = 0000 AM else if(time_expressed >= 1300) twelve_hours = time_expressed - 1200 PM else if(time_expressed >= 1200) twelve_hours = time_expressed AM else twelve_hours = time_expressed AM twelve_hour_format.java https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 6/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com import java.util.Scanner; Home Study tools public class twelve_hour_format My courses My books Career Life { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter time in 2400 format: "); int time_expressed = sc.nextInt(); sc.nextLine(); if(time_expressed < 0) { System.out.println("Time cannot be negative"); } else if( time_expressed / 100 > 24 || time_expressed >2400) { System.out.println("Time cannot be more than 2400"); } else if(time_expressed % 100 > 59) { System.out.println("Invalid minutes"); } else { if(time_expressed == 2400) System.out.println("0000 AM"); else if(time_expressed >= 1300) System.out.println(time_expressed-1200 + " PM"); // else if(time_expressed >=1200) System.out.println(time_expressed + " PM"); else System.out.println(time_expressed + " AM"); } } } View comments (8) THANKS https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 7/8 11/18/21, 7:39 PM I. Construct A Solution Algorithm For The Followin... | Chegg.com Questions viewed by other students Home Study tools My courses My books Career Life Q: Need help creating a webpage for HOTEL. A: See answer Q: Part 1) Construct a solution algorithm for the following problems. Your solution should contain: • A defining problem • A pseudo code algorithm • A desk check of the algorithm 1. An Employee file contains the employee number, employee name, department number and their salary. The department number contains value 10, 20 and 30. Increment for the employee will be calculated depends on... A: See answer 100% (10 ratings) Show more COMPANY LEGAL & POLICIES CHEGG PRODUCTS AND SERVICES CHEGG NETWORK CUSTOMER SERVICE © 2003-2021 Chegg Inc. All rights reserved. https://www.chegg.com/homework-help/questions-and-answers/-construct-solution-algorithm-following-problems-solution-contain-defining-problem-ps… 8/8