0% found this document useful (0 votes)
24 views

Practical - Exercise2 (Class and Default Const)

This document provides instructions for a programming assignment in Java involving object-oriented concepts. Students are asked to write a Student class with attributes for first and last name, mark, and grade. The class should allow assigning names and marks from user input and calculating the grade based on marks criteria in a table. It also provides sample output, problem solving tips, and objectives for learning object-oriented programming concepts in Java like using constructors, set and get methods, and translating specifications into code.

Uploaded by

Dalal Saadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Practical - Exercise2 (Class and Default Const)

This document provides instructions for a programming assignment in Java involving object-oriented concepts. Students are asked to write a Student class with attributes for first and last name, mark, and grade. The class should allow assigning names and marks from user input and calculating the grade based on marks criteria in a table. It also provides sample output, problem solving tips, and objectives for learning object-oriented programming concepts in Java like using constructors, set and get methods, and translating specifications into code.

Uploaded by

Dalal Saadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

September 6, 2018 [ object-oriented programming – CS102 ]]

Name : ___________________________________________ ID: _______________ / 20


Duration: 180 minutes

This document is divided into 5 sections:


1. Instructions
2. Assignment objectives
3. Description of problem
4. Sample of output
5. Problem solving tips

INSTRUCTIONS:

You are required to write a program in JAVA based on the problem description given. Read the
problem description and examine the sample of output; then study the program design given.
Using the problem-solving tips as a guide, write a complete program with necessary useful
comment for good documentation. Compile and execute the program.

ASSIGNMENT OBJECTIVES:
1. Learning objectives
a. To introduce business problem specification/requirement and translates into JAVA codes.
b. To practice writing simple application of deploying object-oriented programming concept
using JAVA.
2. Learning outcomes:
a. Reflect ability to write a program consisting of data members, a constructor, and set and
get methods.
b. Perform set and get method calls according to the given program flow.
c. Translate user specification into JAVA statements.
d. Write and compile an error free JAVA application.

DESCRIPTION OF PROBLEM:

Write a program contained a class Student which has firstName, lastName, mark, grade. The
class allows object instance to assign firstName, lastName and mark from input user and
perform and assign grade based on mark’s criteria displayed below.

Table 1
MARKS 95 - 90 - 85 - 80 - 75 - 70 - 65 - 60 -
0 - <60
INTERVAL 100 <95 <90 <85 <80 <75 <70 <65
LETTER
A+ A B+ B C+ C D+ D F
GRADE

Practical 2 S.H. Haris , Sem 171


Page 1 of 2
September 6, 2018 [ object-oriented programming – CS102 ]]

SAMPLE OF OUTPUT:

Enter student details:


First Name: John
Last Name: Kendall
Marks : 96

-------------------------------------------------------------------
First Name Last Name Grade
John Kendall A+

Another student? (Yes – 1, No - 0):> 1

Enter student details:


First Name: Mary
Last Name: Kendall
Marks : 76

-------------------------------------------------------------------
FirstName Last Name Grade
Mary Kendall C+

Another student? (Yes – 1, No - 0):> 0


Total student : 2
Exit..

PROBLEM SOLVING TIPS:

Num Tips Grade


a) Class Student with four attributes firstName, lastName, mark, grade / 2m
b) Define a default constructor which is empty.
/2m

c) public set and get method for all attributes. /3m


d) public method gradeTo in which will receive input mark and assign a grade
character to grade based on list of conditions displayed in Table 1. /3m
e) public method displayAll() which will show output as in sample output / 2m

f) A main program in which will create object instances, then derives user
input and perform suitable set and get method to reflect output as shown /8m
above.
Total /20m

 Finally, submit your work on Moodle at the link provided.

Practical 2 S.H. Haris , Sem 171


Page 2 of 2

You might also like