package week5; /* Please create an algorithm and a coded solution based on your created algorithm for the following question: For this task, you are required to create a program that evaluates an input from a user and compares it against a decision block. The program should ask the user for a colour. Based on the colour input by the user, create a block of decision statements using if-else which will execute one of the following: • if the colour is blue, tell the user they have won • if the colour is red, tell the user they have come in second • if the colour is green, tell the user they come in third • if the colour is yellow, tell the user they have come in fourth • if the colour cannot be found, tell the user, better luck next time ### Algorithm: - Start - Prompt the user to input a colour. - Read the user input. - If the input is "blue", print "You have won." - else If the input is "red", print "You have come in second." - else If the input is "green", print "You come in third." - else If the input is "yellow", print "You come in fourth." - else, print "Better luck next time." - End the program */ import java.util.Scanner; public class PracQ1 { public static void main(String[] args) { Scanner myInput = new Scanner(System.in); System.out.println("Please input your chosen colour: "); String colour = myInput.nextLine(); if(colour.equals("blue")){ System.out.println("Congratualtions! You have won!"); } else if(colour.equals("red")){ System.out.println("Not bad!. You have come in second!"); } else if(colour.equals("green")){ System.out.println("Not too shabby!. You have come in third!"); } else if(colour.equals("yellow")){ System.out.println("You have come in fourth!"); } else { System.out.println("Better luck next time!"); } } }