Course web page: Introduction to Computer Science for majors II James Tam Return to the course web page

CPSC 233: Mini-Assignment #1

Due Sept 18 at 4 PM

New Concepts to be applied for the assignment

Aside from the 'main()' method you are not to write static methods for this assignment. (If you don't know what I'm referring to by static methods, I will be discussing this topic later in the course).

Description

 
  • Define one class 'Exponents', your code will be all be contained in the main() method of this class. The file name of course must be called "Exponents.java". (1 mark for an empty class and method definition)
 
  • The program will prompt the user for a base and a power (1 mark each x 2 = 2 marks total) either of which can be any non-negative integer
   
  • The program can correctly calculate an exponent when the power is zero (the result is just one). (1 mark)
   
  • The program can correctly calculate (using a loop) an exponent when the power is greater than zero. (2 marks)

Marking key

Marks earned 6 5 4 3 2 1 0
Grade point 4.0 3.5 3.0 2.0 1.0 0.7 0

Submitting your work:

  1. Assignments (source code/'dot-java' file) must be electronically submitted according to [the assignment submission requirements] using [D2L].
  2. As a reminder, you are not allowed to work in groups for this class. Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following [link].

External libraries that can be used (unless otherwise told don't use external code).

  1. You cannot use methods other than the ones for input (Scanner class) and output: printf(), print(), println(). Obviously math library methods, such as the ones that calculate an exponent for you, cannot be used.