Develop an algorithm which incorporates decision making and Boolean logic, create a flowchart, and then develop the code. The algorithm could be a classification algorithm, a process for solving a problem, or a few questions which help a user buy a car.

Respuesta :

Answer:

public class DecisionMaking{

private boolean decision;

Scanner input = new Scanner(System.in);

public void askQuestions(){

// 1, 2, 3, 4 questions

// take note each time a user answers yes or no

// have a counter for these answers

// ex: if user answers 3 out of 4 questions then recommend a specific car

String userInput = "";

int yesCounter = 0;

int noCounter = 0;

System.out.println("Would you like a car with a hatchback?");

userInput = input.nextLine();

addCounter(userInput);

// ask the next question....and so on.

}

//make method for increasing counters

public void addCounter(String answer){

if(answer.equals("yes") || answer.equals("Yes")){

yesCounter++;

}

else{

noCounter++;

}

public static void main(String[] args){

DecisionMaking obj1 = new DecisionMaking();

// make a questionare where you ask the user different questions about a car

// make 4 questions

obj1.askQuetions();

}

}

Explanation: