Assignment 3
Category: Assignments Published on Wednesday, 15 February 2012 14:12 Written by Daniel Gibbons Hits: 262
CSc 2310
Write a program that consists of one class called CSc2310. The constructor should take an int as a parameter and store it in a private instance variable called numRepetitions with public getters and setters. When the main method is run, it should construct an instance of this class, passing it a value of 100. You should then call execute() on the instance of the CSc2310 class you created.
The execute() method should loop numRepetitions times. The loop should print the numbers 1 up to numRepititions each of their own line. However, if the loop is a multiple of 3, it should print CSc instead of the number. If the loop is a multiple of 5, it should print 2310 instead of the number. If the loop is a multiple of 3 and 5, it should print CSc 2310 instead of the number.