Answer to Question #250349 in Java | JSP | JSF for guru

Question #250349

To qualify for an International Conference for Women in Computing (ICWC) next year in Toronto, Canada a student have got a distinction (a mark greater than 75) in PRG510S, be a female, and below the age of 25. Write a simple program that receives a mark, gender, and age from the keyboard and displays a corresponding message basing on the input.

Sample Run 1:

Mark: 70

Gender: female

Age: 21

Output1: Unfortunately you do not qualify!

Sample Run 2

Mark: 83

Gender: female

Age: 21

Output2: Congratulations! You might be in Toronto, Canada next year for ICWC!

1
Expert's answer
2021-10-15T01:28:19-0400

Source code

import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
	    Scanner in =new Scanner(System.in);
		System.out.print("Mark: ");
		int mark=in.nextInt();
		System.out.print("Gender: ");
		String gender=in.next();
		System.out.print("Age: ");
		int age=in.nextInt();
		if((mark>75 && gender.equals("female") && age<25)){
		    System.out.println("Congratulations! You might be in Toronto, Canada next year for ICWC!");
		}
		else{
		    System.out.println("Unfortunately you do not qualify!");
		}
		
	}
}

Output 1




Output 2





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS