0% found this document useful (0 votes)
28 views1 page

Programming Assignment-2

Uploaded by

LLLLL MMMMM
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)
28 views1 page

Programming Assignment-2

Uploaded by

LLLLL MMMMM
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/ 1

COMP 1412 - Introduction to CS II

Chapter - 4
Faculty: Likhitha Kanagala
Programming Assignment-2

Name: __ __

Due Date: __10/09/2024___

Grade: _______

Section-I

Answer any one of the questions below:

1. Write a class called Number of Goals that represents the total number of goals scored by a football
team. The Number of Goals class should contain a single integer as instance data, representing the
number of goals scored. Write a constructor to initialize the number of goals to zero. Write a method
called set Goal that increments the value by one whenever a goal is scored, and another method called
get Goal that returns the total number of goals scored so far. Finally, create a driver class called Goal
Tracker that creates a few Numbers of Goals objects and tests their methods.
(OR)
2. Write a class called Bit Value that represents binary digits that can be set to true or false. Create a
driver class called Bits whose main method instantiates and sets a few bits to true.

You might also like