This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 4
9 June 2000
Due: Friday, June 9 at midnight
Late penalties: 20 points per partial day late. That is, programs
turned in after midnight Friday and before midnight Saturday
will have 20 points deducted for late, programs turned in after
midnight Saturday and before midnight Sunday will have a total
of 40 points deducted for late, etc. Since this assignment
uses the Drawing Window, you should give considerable attention
to getting the assignment in early if you cannot use the
Drawing Window from a remote location.
Total point value of assignment: 100 points
Late submissions not accepted after: Monday, June 12 at midnight
This assignment is to be done INDIVIDUALLY.
Create a directory, A4, which will contain all parts of this assignment.
(In this assignment the directory A4 will contain a single file
named Asg4.java.)
The objectives of this program are to give you more experience
designing program logic and writing recursive procedures.
Input:
Input should be read from the ConsoleWindow.
Request the user for two numbers. Read the first as a double.
The second should be an integer.
Output:
Print your name, the assignment number, and a short description
of the assignment in the Console Window.
You are to "echo print" the input. (i.e., print the numbers
that were read in as part of the output) If we call the
first numker x and the second number k, you are to output
x to the kth power.
Other requirements:
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Use a recursive function to compute x to the kth power. Use
the least number of multiplications possible (and only
multiplication may be performed).
Submit your program using the handin command. There is a link to
the handin description on your lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
In the opinion of the instructor the program is an honest attempt
to complete the assignment as described 10 pts.
If the above requirement is met:
Required documentation 10 pts.
Style standards 10 pts.
If the two previous requirements are not met, no further points
will be awarded.
The program compiles without error. 10 pts.
If the program does not compile, no further points will be awarded.
A recursive function computes the kth power of x for positive k. 10 pts.
The program correctly handles k is zero. 10 pts.
The program correctly handles negative k. Correct handling
includes using the recursive function in this computation. 10 pts.
The recursive function to compute the kth power of x
performs the least number of multiplications possible. 30 pts.