Computer Science, asked by aayushoo3, 10 months ago

write a java program to accept name and age of student check whether major or minor print the name and age of student also print "college student" if the student is major otherwise print "school student" (major means age greater than or equal to 18)​

Answers

Answered by Anonymous
13

import java.util.*;

public class Student

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

int age;

String "name", "College student";

System.out.println("Input the age");

age=in.nextInt();

System.out.println("name="+ name);

name=in.nextString();

System.out.println("College student=" + College student);

College student = in.nextString();

if(age>=18)

{

System.out.println("major");

}

else

{

System.out.println("minor");

}

}

}

Similar questions