SlideShare a Scribd company logo
the code below is a recommendation system application to suggest a suitable degree program (or
department) based on student interest and industry demand.
-main class code:
package project;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class project {
private static final int MAX_INVALID_INPUTS = 3;
private static final String LOG_FILE_PATH = "failed_attempts.txt";
public static void main(String[] args) {
SE_dep SE_obj = new SE_dep();
CSAIDepartment csaiDepartment = new CSAIDepartment();
CYDepartment cyDepartment = new CYDepartment();
DS_Dep dsDep = new DS_Dep();
double SE_minIndustSalary;
double SE_prevGPA;
String SE_interestOfStudent;
Scanner input = new Scanner(System.in);
System.out.println("Please enter the Minimum acceptable industry salary: ");
SE_minIndustSalary = validateInput(input, 10); // Maximum of 10 digits
System.out.println("Please Enter Your previous GPA: ");
SE_prevGPA = validateInput(input, 2); // Maximum of 2 digits
SE_interestOfStudent = validateInterestInput(input);
System.out.println("Student inputs: Minimum acceptable industry salary[" +
SE_minIndustSalary + "] Previous GPA[" + SE_prevGPA + "] Computer Programming
interest[" + SE_interestOfStudent + "]");
System.out.println("Suggested programs:nn");
SE_obj.ifIncluded_SE(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
cyDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
csaiDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA,
SE_interestOfStudent);
dsDep.DS_Program(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent);
double studyHours = SE_prevGPA * 1.0; // Each GPA point corresponds to 1 hour of study
int hours = (int) studyHours; // Extract the integer part (hours)
int minutes = (int) ((studyHours - hours) * 60); // Calculate the minutes
System.out.println("Required study hours (at home beside lectures): " + hours + " hours and
" + minutes + " minutes");
input.close();
}
private static double validateInput(Scanner input, int maxDigits) {
int invalidInputs = 0;
while (invalidInputs < MAX_INVALID_INPUTS) {
String userInput = input.next();
try {
double value = Double.parseDouble(userInput);
if (userInput.length() <= maxDigits) {
return value; // Input has the desired number of digits, return the value
} else {
System.out.println("Invalid input! Please enter a number with no more than " +
maxDigits + " digits: ");
invalidInputs++;
}
} catch (NumberFormatException e) {
invalidInputs++;
System.out.println("Invalid input! Please enter a valid number: ");
}
}
System.out.println("Maximum number of invalid inputs reached. Exiting...");
logFailedAttempt("Invalid input: " + input);
System.exit(0); // Terminate the program gracefully
return 0; // This line won't be executed, added to satisfy the method return type
}
private static String validateInterestInput(Scanner input) {
int invalidInputs = 0;
while (invalidInputs < MAX_INVALID_INPUTS) {
System.out.println("Please enter Computer Programming interest (Low, Medium, High,
or Very high): ");
String userInput = input.next();
if (userInput.equalsIgnoreCase("Low") || userInput.equalsIgnoreCase("Medium")
|| userInput.equalsIgnoreCase("High") || userInput.equalsIgnoreCase("Very high")) {
return userInput;
} else {
invalidInputs++;
System.out.println("Invalid input! Please enter a valid interest level.");
}
}
System.out.println("Maximum number of invalid inputs reached. Exiting...");
logFailedAttempt("Invalid input: " + input);
System.exit(0); // Terminate the program gracefully
return ""; // This line won't be executed, added to satisfy the method return type
}
private static void logFailedAttempt(String prompt) {
try (PrintWriter writer = new PrintWriter(new FileWriter(LOG_FILE_PATH, true))) {
InetAddress ip = InetAddress.getLocalHost();
String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new
Date());
writer.println("Failed attempt at " + currentTime + " from IP: " + ip.getHostAddress());
writer.println();
} catch (IOException e) {
System.out.println("Failed to log the failed attempt.");
}}}
Note:
- The program should be written using Java language
- Need the solution Step by step

More Related Content

Similar to the code below is a recommendation system application to suggest a s.pdf

Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
KimVeeL
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
gersonjack
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
KimVeeL
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
mayorothenguyenhob69
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 
Estructura secuencial -garcia
Estructura secuencial -garciaEstructura secuencial -garcia
Estructura secuencial -garcia
Daneziita Laulate Flores
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
theodorelove43763
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
arihantmum
 
import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docx
Katecate1
 
Introduction to Java Programming Part 2
Introduction to Java Programming Part 2Introduction to Java Programming Part 2
Introduction to Java Programming Part 2
university of education,Lahore
 
3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf
AbhishekSingh757567
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
java program assigment -2
java program assigment -2java program assigment -2
java program assigment -2
Ankit Gupta
 
programming for Calculator in java
programming for Calculator in javaprogramming for Calculator in java
programming for Calculator in java
One97 Communications Limited
 
Java programs
Java programsJava programs
Java programs
FathimaLidiya
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
Coding Assignment Help
 

Similar to the code below is a recommendation system application to suggest a s.pdf (20)

Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Estructura secuencial -garcia
Estructura secuencial -garciaEstructura secuencial -garcia
Estructura secuencial -garcia
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
 
import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docx
 
Introduction to Java Programming Part 2
Introduction to Java Programming Part 2Introduction to Java Programming Part 2
Introduction to Java Programming Part 2
 
3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
java program assigment -2
java program assigment -2java program assigment -2
java program assigment -2
 
programming for Calculator in java
programming for Calculator in javaprogramming for Calculator in java
programming for Calculator in java
 
Java programs
Java programsJava programs
Java programs
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 

More from rajatchugh13

tell what the program will print to the file and the screen.1. i.pdf
tell what the program will print to the file and the screen.1. i.pdftell what the program will print to the file and the screen.1. i.pdf
tell what the program will print to the file and the screen.1. i.pdf
rajatchugh13
 
Task 1 Demonstrating Inheritance.pdf
Task 1 Demonstrating Inheritance.pdfTask 1 Demonstrating Inheritance.pdf
Task 1 Demonstrating Inheritance.pdf
rajatchugh13
 
Suppose that you have hospital management system. The system has thr.pdf
Suppose that you have hospital management system. The system has thr.pdfSuppose that you have hospital management system. The system has thr.pdf
Suppose that you have hospital management system. The system has thr.pdf
rajatchugh13
 
Suppose we have two tax systems. The first is given by the equation (i.pdf
Suppose we have two tax systems. The first is given by the equation (i.pdfSuppose we have two tax systems. The first is given by the equation (i.pdf
Suppose we have two tax systems. The first is given by the equation (i.pdf
rajatchugh13
 
Subject Audit and AssuranceProjection of sample results is requ.pdf
Subject Audit and AssuranceProjection of sample results is requ.pdfSubject Audit and AssuranceProjection of sample results is requ.pdf
Subject Audit and AssuranceProjection of sample results is requ.pdf
rajatchugh13
 
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdfStockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
rajatchugh13
 
The Diversified Portfolio Corporation provides investment advice to .pdf
The Diversified Portfolio Corporation provides investment advice to .pdfThe Diversified Portfolio Corporation provides investment advice to .pdf
The Diversified Portfolio Corporation provides investment advice to .pdf
rajatchugh13
 
The concepts of blended and discrete presentation are used in financ.pdf
The concepts of blended and discrete presentation are used in financ.pdfThe concepts of blended and discrete presentation are used in financ.pdf
The concepts of blended and discrete presentation are used in financ.pdf
rajatchugh13
 
specify the following Tru or false 1. In dependent variable, the .pdf
specify the following Tru or false 1. In dependent variable, the .pdfspecify the following Tru or false 1. In dependent variable, the .pdf
specify the following Tru or false 1. In dependent variable, the .pdf
rajatchugh13
 
Southeastern Oklahoma State Universitys business program has the faci.pdf
Southeastern Oklahoma State Universitys business program has the faci.pdfSoutheastern Oklahoma State Universitys business program has the faci.pdf
Southeastern Oklahoma State Universitys business program has the faci.pdf
rajatchugh13
 

More from rajatchugh13 (10)

tell what the program will print to the file and the screen.1. i.pdf
tell what the program will print to the file and the screen.1. i.pdftell what the program will print to the file and the screen.1. i.pdf
tell what the program will print to the file and the screen.1. i.pdf
 
Task 1 Demonstrating Inheritance.pdf
Task 1 Demonstrating Inheritance.pdfTask 1 Demonstrating Inheritance.pdf
Task 1 Demonstrating Inheritance.pdf
 
Suppose that you have hospital management system. The system has thr.pdf
Suppose that you have hospital management system. The system has thr.pdfSuppose that you have hospital management system. The system has thr.pdf
Suppose that you have hospital management system. The system has thr.pdf
 
Suppose we have two tax systems. The first is given by the equation (i.pdf
Suppose we have two tax systems. The first is given by the equation (i.pdfSuppose we have two tax systems. The first is given by the equation (i.pdf
Suppose we have two tax systems. The first is given by the equation (i.pdf
 
Subject Audit and AssuranceProjection of sample results is requ.pdf
Subject Audit and AssuranceProjection of sample results is requ.pdfSubject Audit and AssuranceProjection of sample results is requ.pdf
Subject Audit and AssuranceProjection of sample results is requ.pdf
 
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdfStockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
Stockton Company Adjusted Trial Balance December 31 Line Item Descript.pdf
 
The Diversified Portfolio Corporation provides investment advice to .pdf
The Diversified Portfolio Corporation provides investment advice to .pdfThe Diversified Portfolio Corporation provides investment advice to .pdf
The Diversified Portfolio Corporation provides investment advice to .pdf
 
The concepts of blended and discrete presentation are used in financ.pdf
The concepts of blended and discrete presentation are used in financ.pdfThe concepts of blended and discrete presentation are used in financ.pdf
The concepts of blended and discrete presentation are used in financ.pdf
 
specify the following Tru or false 1. In dependent variable, the .pdf
specify the following Tru or false 1. In dependent variable, the .pdfspecify the following Tru or false 1. In dependent variable, the .pdf
specify the following Tru or false 1. In dependent variable, the .pdf
 
Southeastern Oklahoma State Universitys business program has the faci.pdf
Southeastern Oklahoma State Universitys business program has the faci.pdfSoutheastern Oklahoma State Universitys business program has the faci.pdf
Southeastern Oklahoma State Universitys business program has the faci.pdf
 

Recently uploaded

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes PaixĂŁo
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 

Recently uploaded (20)

Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 

the code below is a recommendation system application to suggest a s.pdf

  • 1. the code below is a recommendation system application to suggest a suitable degree program (or department) based on student interest and industry demand. -main class code: package project; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.InetAddress; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Scanner; public class project { private static final int MAX_INVALID_INPUTS = 3; private static final String LOG_FILE_PATH = "failed_attempts.txt"; public static void main(String[] args) { SE_dep SE_obj = new SE_dep(); CSAIDepartment csaiDepartment = new CSAIDepartment(); CYDepartment cyDepartment = new CYDepartment(); DS_Dep dsDep = new DS_Dep(); double SE_minIndustSalary; double SE_prevGPA; String SE_interestOfStudent; Scanner input = new Scanner(System.in); System.out.println("Please enter the Minimum acceptable industry salary: "); SE_minIndustSalary = validateInput(input, 10); // Maximum of 10 digits System.out.println("Please Enter Your previous GPA: "); SE_prevGPA = validateInput(input, 2); // Maximum of 2 digits SE_interestOfStudent = validateInterestInput(input); System.out.println("Student inputs: Minimum acceptable industry salary[" + SE_minIndustSalary + "] Previous GPA[" + SE_prevGPA + "] Computer Programming interest[" + SE_interestOfStudent + "]"); System.out.println("Suggested programs:nn");
  • 2. SE_obj.ifIncluded_SE(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent); cyDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent); csaiDepartment.recommendPrograms(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent); dsDep.DS_Program(SE_minIndustSalary, SE_prevGPA, SE_interestOfStudent); double studyHours = SE_prevGPA * 1.0; // Each GPA point corresponds to 1 hour of study int hours = (int) studyHours; // Extract the integer part (hours) int minutes = (int) ((studyHours - hours) * 60); // Calculate the minutes System.out.println("Required study hours (at home beside lectures): " + hours + " hours and " + minutes + " minutes"); input.close(); } private static double validateInput(Scanner input, int maxDigits) { int invalidInputs = 0; while (invalidInputs < MAX_INVALID_INPUTS) { String userInput = input.next(); try { double value = Double.parseDouble(userInput); if (userInput.length() <= maxDigits) { return value; // Input has the desired number of digits, return the value } else { System.out.println("Invalid input! Please enter a number with no more than " + maxDigits + " digits: "); invalidInputs++; } } catch (NumberFormatException e) { invalidInputs++; System.out.println("Invalid input! Please enter a valid number: "); } } System.out.println("Maximum number of invalid inputs reached. Exiting..."); logFailedAttempt("Invalid input: " + input); System.exit(0); // Terminate the program gracefully return 0; // This line won't be executed, added to satisfy the method return type }
  • 3. private static String validateInterestInput(Scanner input) { int invalidInputs = 0; while (invalidInputs < MAX_INVALID_INPUTS) { System.out.println("Please enter Computer Programming interest (Low, Medium, High, or Very high): "); String userInput = input.next(); if (userInput.equalsIgnoreCase("Low") || userInput.equalsIgnoreCase("Medium") || userInput.equalsIgnoreCase("High") || userInput.equalsIgnoreCase("Very high")) { return userInput; } else { invalidInputs++; System.out.println("Invalid input! Please enter a valid interest level."); } } System.out.println("Maximum number of invalid inputs reached. Exiting..."); logFailedAttempt("Invalid input: " + input); System.exit(0); // Terminate the program gracefully return ""; // This line won't be executed, added to satisfy the method return type } private static void logFailedAttempt(String prompt) { try (PrintWriter writer = new PrintWriter(new FileWriter(LOG_FILE_PATH, true))) { InetAddress ip = InetAddress.getLocalHost(); String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); writer.println("Failed attempt at " + currentTime + " from IP: " + ip.getHostAddress()); writer.println(); } catch (IOException e) { System.out.println("Failed to log the failed attempt."); }}} Note: - The program should be written using Java language - Need the solution Step by step