SlideShare a Scribd company logo
1 of 4
Download to read offline
- the modification will be done in Main class
- first, asks the user if it is a regular user or from the company.
-second, compare the username and password if it is from a company.
note:
-the 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();
CSAI_Dep csaiDepartment = new CSAI_Dep();
CY_Dep cyDepartment = new CY_Dep();
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, 3); // Maximum of 3 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.");
}}}

More Related Content

Similar to - the modification will be done in Main class- first, asks the use.pdf

2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docxajoy21
 
My code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdfMy code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdfadianantsolutions
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxtheodorelove43763
 
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 .pdfmayorothenguyenhob69
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdffathimafancy
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3Dillon Lee
 
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfSummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfARORACOCKERY2111
 
Java Program I keep receiving the following error in my code- Can you.pdf
Java Program I keep receiving the following error in my code- Can you.pdfJava Program I keep receiving the following error in my code- Can you.pdf
Java Program I keep receiving the following error in my code- Can you.pdfRyanF2PLeev
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specificationsrajkumari873
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming AssignmentCoding Assignment Help
 
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxalanfhall8953
 

Similar to - the modification will be done in Main class- first, asks the use.pdf (20)

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
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
My code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdfMy code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdf
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
 
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
 
07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
 
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdfSummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
SummaryHW6 Account ManagementIn HW4, you kept track of multiple.pdf
 
Java Program I keep receiving the following error in my code- Can you.pdf
Java Program I keep receiving the following error in my code- Can you.pdfJava Program I keep receiving the following error in my code- Can you.pdf
Java Program I keep receiving the following error in my code- Can you.pdf
 
JavaExamples
JavaExamplesJavaExamples
JavaExamples
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specifications
 
Java programs
Java programsJava programs
Java programs
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
 

More from hanumanparsadhsr

[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf
[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf
[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdfhanumanparsadhsr
 
1.Professor Goodheart gives two midterms in her class. She uses the .pdf
1.Professor Goodheart gives two midterms in her class. She uses the .pdf1.Professor Goodheart gives two midterms in her class. She uses the .pdf
1.Professor Goodheart gives two midterms in her class. She uses the .pdfhanumanparsadhsr
 
1.) Prepare the general journal entry on May 1 to record the admissi.pdf
1.) Prepare the general journal entry on May 1 to record the admissi.pdf1.) Prepare the general journal entry on May 1 to record the admissi.pdf
1.) Prepare the general journal entry on May 1 to record the admissi.pdfhanumanparsadhsr
 
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdfhanumanparsadhsr
 
1. Why is it important that governments and not-for-profits coordina.pdf
1. Why is it important that governments and not-for-profits coordina.pdf1. Why is it important that governments and not-for-profits coordina.pdf
1. Why is it important that governments and not-for-profits coordina.pdfhanumanparsadhsr
 
1. Which of the following is not true A. Commercial banks process i.pdf
1. Which of the following is not true A. Commercial banks process i.pdf1. Which of the following is not true A. Commercial banks process i.pdf
1. Which of the following is not true A. Commercial banks process i.pdfhanumanparsadhsr
 
1.1 Which of the following is NOT a reason for process termination .pdf
1.1 Which of the following is NOT a reason for process termination .pdf1.1 Which of the following is NOT a reason for process termination .pdf
1.1 Which of the following is NOT a reason for process termination .pdfhanumanparsadhsr
 
1. Use the mmls command to display the partition table of the DD ima.pdf
1. Use the mmls command to display the partition table of the DD ima.pdf1. Use the mmls command to display the partition table of the DD ima.pdf
1. Use the mmls command to display the partition table of the DD ima.pdfhanumanparsadhsr
 
1. In relation to the inclusive approach to corporate governance, wh.pdf
1. In relation to the inclusive approach to corporate governance, wh.pdf1. In relation to the inclusive approach to corporate governance, wh.pdf
1. In relation to the inclusive approach to corporate governance, wh.pdfhanumanparsadhsr
 
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdfhanumanparsadhsr
 
1. Explain how international accounting is distinct from domestic ac.pdf
1. Explain how international accounting is distinct from domestic ac.pdf1. Explain how international accounting is distinct from domestic ac.pdf
1. Explain how international accounting is distinct from domestic ac.pdfhanumanparsadhsr
 
1. Describe the concept of social loafing. Why does social loafing o.pdf
1. Describe the concept of social loafing. Why does social loafing o.pdf1. Describe the concept of social loafing. Why does social loafing o.pdf
1. Describe the concept of social loafing. Why does social loafing o.pdfhanumanparsadhsr
 
1. All of the following exemplify an individualistic culture EXCEPT .pdf
1. All of the following exemplify an individualistic culture EXCEPT .pdf1. All of the following exemplify an individualistic culture EXCEPT .pdf
1. All of the following exemplify an individualistic culture EXCEPT .pdfhanumanparsadhsr
 
1)What is the objective of external auditing Describe the role of e.pdf
1)What is the objective of external auditing Describe the role of e.pdf1)What is the objective of external auditing Describe the role of e.pdf
1)What is the objective of external auditing Describe the role of e.pdfhanumanparsadhsr
 
1) What is the passage of title to goods2) How does the UCC.pdf
1) What is the passage of title to goods2) How does the UCC.pdf1) What is the passage of title to goods2) How does the UCC.pdf
1) What is the passage of title to goods2) How does the UCC.pdfhanumanparsadhsr
 
-Create a folder on your computer called week3-Create a script i.pdf
-Create a folder on your computer called week3-Create a script i.pdf-Create a folder on your computer called week3-Create a script i.pdf
-Create a folder on your computer called week3-Create a script i.pdfhanumanparsadhsr
 
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdfhanumanparsadhsr
 
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdfhanumanparsadhsr
 

More from hanumanparsadhsr (18)

[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf
[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf
[10 marks] Ernest, a CST student at BCIT is designing an autonomous d.pdf
 
1.Professor Goodheart gives two midterms in her class. She uses the .pdf
1.Professor Goodheart gives two midterms in her class. She uses the .pdf1.Professor Goodheart gives two midterms in her class. She uses the .pdf
1.Professor Goodheart gives two midterms in her class. She uses the .pdf
 
1.) Prepare the general journal entry on May 1 to record the admissi.pdf
1.) Prepare the general journal entry on May 1 to record the admissi.pdf1.) Prepare the general journal entry on May 1 to record the admissi.pdf
1.) Prepare the general journal entry on May 1 to record the admissi.pdf
 
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
1.6 1.7 1.8 1.4 1.5 Categorize each of the following items as either.pdf
 
1. Why is it important that governments and not-for-profits coordina.pdf
1. Why is it important that governments and not-for-profits coordina.pdf1. Why is it important that governments and not-for-profits coordina.pdf
1. Why is it important that governments and not-for-profits coordina.pdf
 
1. Which of the following is not true A. Commercial banks process i.pdf
1. Which of the following is not true A. Commercial banks process i.pdf1. Which of the following is not true A. Commercial banks process i.pdf
1. Which of the following is not true A. Commercial banks process i.pdf
 
1.1 Which of the following is NOT a reason for process termination .pdf
1.1 Which of the following is NOT a reason for process termination .pdf1.1 Which of the following is NOT a reason for process termination .pdf
1.1 Which of the following is NOT a reason for process termination .pdf
 
1. Use the mmls command to display the partition table of the DD ima.pdf
1. Use the mmls command to display the partition table of the DD ima.pdf1. Use the mmls command to display the partition table of the DD ima.pdf
1. Use the mmls command to display the partition table of the DD ima.pdf
 
1. In relation to the inclusive approach to corporate governance, wh.pdf
1. In relation to the inclusive approach to corporate governance, wh.pdf1. In relation to the inclusive approach to corporate governance, wh.pdf
1. In relation to the inclusive approach to corporate governance, wh.pdf
 
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf
1. Maurice has the following utility functionU (X, Y ) = 20X + 60.pdf
 
1. Explain how international accounting is distinct from domestic ac.pdf
1. Explain how international accounting is distinct from domestic ac.pdf1. Explain how international accounting is distinct from domestic ac.pdf
1. Explain how international accounting is distinct from domestic ac.pdf
 
1. Describe the concept of social loafing. Why does social loafing o.pdf
1. Describe the concept of social loafing. Why does social loafing o.pdf1. Describe the concept of social loafing. Why does social loafing o.pdf
1. Describe the concept of social loafing. Why does social loafing o.pdf
 
1. All of the following exemplify an individualistic culture EXCEPT .pdf
1. All of the following exemplify an individualistic culture EXCEPT .pdf1. All of the following exemplify an individualistic culture EXCEPT .pdf
1. All of the following exemplify an individualistic culture EXCEPT .pdf
 
1)What is the objective of external auditing Describe the role of e.pdf
1)What is the objective of external auditing Describe the role of e.pdf1)What is the objective of external auditing Describe the role of e.pdf
1)What is the objective of external auditing Describe the role of e.pdf
 
1) What is the passage of title to goods2) How does the UCC.pdf
1) What is the passage of title to goods2) How does the UCC.pdf1) What is the passage of title to goods2) How does the UCC.pdf
1) What is the passage of title to goods2) How does the UCC.pdf
 
-Create a folder on your computer called week3-Create a script i.pdf
-Create a folder on your computer called week3-Create a script i.pdf-Create a folder on your computer called week3-Create a script i.pdf
-Create a folder on your computer called week3-Create a script i.pdf
 
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf
!DOCTYPE htmlhtml lang=enheadmeta charset=UTF-.pdf
 
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf
!!ALL COPYRIGHTS BELONG TO THE AUTHORS OF THE ARTICLE BELOW..pdf
 

Recently uploaded

Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 

Recently uploaded (20)

Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 

- the modification will be done in Main class- first, asks the use.pdf

  • 1. - the modification will be done in Main class - first, asks the user if it is a regular user or from the company. -second, compare the username and password if it is from a company. note: -the 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(); CSAI_Dep csaiDepartment = new CSAI_Dep(); CY_Dep cyDepartment = new CY_Dep(); 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: ");
  • 2. SE_prevGPA = validateInput(input, 3); // Maximum of 3 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 {
  • 3. 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);
  • 4. 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."); }}}