Create a class named Student (class definition program). The class contains:

• Private attributes to store values of Student name, Student university and Student mark.
• A method named initialize() to assign initial value to the Student name, Student University and Student mark as specified in the parameter.
• A method named reverse() to display Student name in reverse order.
• A method named determineOUM() to determine if a student comes from Open University Malaysia or not. This method will return true if the value in the object is equal to the specified value.
• A method named determineGrade() to determine grade based on Student mark. This method will return grade of a student.
• A method named toString() that returns a string description for the student.
Given the grades according to marks:

Mark Grade

90 and above A
70 – 89 B
50 – 69 C
0 – 49 D

Create the class program that has main() method for execution. This program should create two Student objects and implement all methods listed in the Student class.

Use your own creativity to implement all methods in Student class and design your interface interactively.

Recommended Answers

All 5 Replies

import java.util.*;

public class reverse1 {
public static void main(String args[])

{

Scanner scanner = new Scanner(System.in);
System.out.println("ENTER NAME--->");

String nama = scanner.nextLine();
System.out.println("YOUR NAME--->\n" +nama);

nama = new StringBuffer(nama).reverse().toString();
System.out.println("YOUR NAME IN REVERSE--->\n" +nama);

}

}
//THIS CODING IS TO REVERSE

You forgot to post the code you are having problems with and your specific questions about those problems. If you are getting errors, please copy and paste here the full text of the error messsages.

import java.util.*;
class grade1{
public static void main (String [] args){

double markah;
for (int i = 1; i>= 0; i ++)
{

Scanner scanner = new Scanner(System.in);
System.out.println("\nENTER YOUR MARK >\n");
markah = scanner.nextDouble ();
System.out.println ("YOUR MARK-->\t" + markah +"\n");

if ((markah >= 90)&&(markah <= 100))
System.out.println ("YOUR GRADE-->\t A\n\nE - FOR EXIT. >\n");

else if ((markah >= 70)&&(markah <= 89))
System.out.println ("YOUR GRADE-->\t B\n\nE - FOR EXIT >\n");

else if ((markah >= 50)&&(markah <= 69))
System.out.println ("YOUR GRADE-->\t C\n\nE - FOR EXIT >\n");

else 
System.out.println ("YOUR GRADE-->\t D\n\nE - FOR EXIT >\n");


}
}
}

Have you solved the problem? If you have questions, you should ask them.

You must go back and read the assignment carefully - you won't get marks for ignoring it. Start with the first five words "Create a class named Student..."
Then follow the rest of the instructions one line at a time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.