Answer to Question #254309 in Java | JSP | JSF for Chakalaka

Question #254309
Create a program that takes in a student first name and average mark obtained, the system should the group the students using the first letter in their name modulus 10 [ Remember that characters are considered as numeric values, hence à ƒ ƒ ¢ € ˜Jà ƒ ƒ ¢ € ™%10 is a valid calculation ]. For example if the student name is Cena, then the student belongs to group 7 because à ƒ ƒ ¢ € ˜Cà ƒ ƒ ¢ € ™%10 = 7 and if the name was Jack then the student belongs to group 4. The program should further use the group number to get the group lecturer and class date as follows: [Hint: If the result is 0 then the student belongs to group 10]
1
Expert's answer
2021-10-20T23:55:19-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Name: ");
        String name = in.nextLine();
        System.out.println("Average mark: ");
        double mark = in.nextDouble();

        System.out.println("Group: " + (name.charAt(0) % 10 == 0 ? "10" : name.charAt(0) % 10));
    }
}

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