Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code to flowchart public class MainClass { public static void main(String[] args) { Scanner input = new Scanner(System.in); UserSkills user = new UserSkills(); user.getUserSkills(input); user.getUserLanguageProficiency(input);

Code to flowchart

public class MainClass {

public static void main(String[] args) { Scanner input = new Scanner(System.in); UserSkills user = new UserSkills();

user.getUserSkills(input); user.getUserLanguageProficiency(input); user.getUserCommunicationSkills(input); user.getUserTechnicalSkills(input); user.getUserExpectedSalary(input);

CareerPath career = new CareerPath(); String suggestedCareer = career.suggestCareer(user); System.out.println("Based on your skills, a suitable career path for you could be: " + suggestedCareer); } } import java.util.InputMismatchException; import java.util.Scanner;

/** * * @author rasyidbejay */ class UserSkills {

private String[] skillsArray; private int expectedSalary; private int languageProficiency; private int communicationSkills; private int technicalSkills;

public void setSkills(String[] skills) { skillsArray = skills; }

public void setExpectedSalary(int salary) { this.expectedSalary = salary; }

public void setLanguageProficiency(int languageProficiency) { if (languageProficiency >= 1 && languageProficiency <= 5) { this.languageProficiency = languageProficiency; } else { System.out.println("Invalid input. Language proficiency must be a value between 1 and 5."); } }

public void setCommunicationSkills(int communicationSkills) { if (communicationSkills >= 1 && communicationSkills <= 5) { this.communicationSkills = communicationSkills; } else { System.out.println("Invalid input. Communication skills must be a value between 1 and 5."); } }

public void setTechnicalSkills(int technicalSkills) { if (technicalSkills >= 1 && technicalSkills <= 5) { this.technicalSkills = technicalSkills; } else { System.out.println("Invalid input. Technical skills must be a value between 1 and 5."); } }

public String[] getSkills() { return skillsArray; }

public void getUserLanguageProficiency(Scanner input) { try { System.out.println("Enter your language proficiency (1-5):"); int languageProficiency = input.nextInt(); setLanguageProficiency(languageProficiency); } catch (InputMismatchException e) { System.out.println("Invalid input. Language proficiency must be a value between 1 and 5."); } finally { input.nextLine(); //clearing the input buffer } }

public void getUserSkills(Scanner input) { System.out.println("Enter your skills (comma-separated):"); String skills = input.nextLine(); setSkills(skills.split(",")); }

public void getUserCommunicationSkills(Scanner input) { try { System.out.println("Enter your communication skills (1-5):"); int communicationSkills = input.nextInt(); setCommunicationSkills(communicationSkills); } catch (InputMismatchException e) { System.out.println("Invalid input. Communication skills must be a value between 1 and 5."); } finally { input.nextLine(); //clearing the input buffer } }

public void getUserExpectedSalary(Scanner input) { try { System.out.println("Enter your expected salary:"); int expectedSalary = input.nextInt(); setExpectedSalary(expectedSalary); } catch (InputMismatchException e) { System.out.println("Invalid input. Expected salary must be a number."); } finally { input.nextLine(); //clearing the input buffer } }

public void getUserTechnicalSkills(Scanner input) { try { System.out.println("Enter your technical skills (1-5):"); int technicalSkills = input.nextInt(); setTechnicalSkills(technicalSkills); } catch (InputMismatchException e) { System.out.println("Invalid input. Technical skills must be a value between 1 and 5."); } finally { input.nextLine(); //clearing the input buffer } }

public int getLanguageProficiency() { return languageProficiency; }

public int getCommunicationSkills() { return communicationSkills; }

public int getTechnicalSkills() { return technicalSkills; }

public int getExpectedSalary() { return expectedSalary; } } class CareerPath {

public String suggestCareer(UserSkills user) { String[] skills = user.getSkills(); int languageProficiency = user.getLanguageProficiency(); int communicationSkills = user.getCommunicationSkills(); int technicalSkills = user.getTechnicalSkills(); int expectedSalary = user.getExpectedSalary();

String suggestedCareer = ""; for (String skill : skills) { if (skill.toLowerCase().contains("programming")) { suggestedCareer += "Software Developer, Web Developer "; break; } else if (skill.toLowerCase().contains("marketing")) { suggestedCareer += "Marketing "; break; } else if (skill.toLowerCase().contains("translation")) { suggestedCareer += "Translator "; break; } } if (languageProficiency >= 4) { suggestedCareer += "Translator "; } if (communicationSkills >= 4) { suggestedCareer += "Marketing "; } if (technicalSkills >= 4) { suggestedCareer += "Software Developer, Web Developer "; } if (expectedSalary >= 10000) { suggestedCareer += "Management "; } if (suggestedCareer.isEmpty()) { suggestedCareer = "Other"; } return suggestedCareer; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

How does perception affect behavior?

Answered: 1 week ago

Question

Additional Factors Affecting Group Communication?

Answered: 1 week ago