Starting from:

$15

Mini-Assignment #1a Solution

New Concepts to be applied for the assignment
Input and output
Variables
Formulas
Decision making/branching
Looping
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, additional marks will be awarded when you implement the features listed below). (Y

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
Points to keep in mind:
Due time: All assignments are due at 4 PM on the due dates listed on the course web page. Late assignments or components of assignments will not be accepted for marking without approval for an extension beforehand. What you have submitted in D2L as of the due date is what will be marked.
Extensions may be granted for reasonable cases by the course instructor with the receipt of the appropriate documentation (e.g., a doctor's note). Typical examples of reasonable cases for an extension include: illness or a death in the family. Cases where extensions will not be granted include situations that are typical of student life: having multiple due dates, work commitments etc. Tutorial instructors (TA's) will not be able to provide extension on their own and must receive permission from the course instructor first. (Note: Forgetting to hand your assignment or a component of your assignment in does not constitute a sufficient reason for handing your assignment late).
Method of submission: You are to submit your assignment using D2L [help link]. Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version etc.). It's your responsibility to do this! (Make sure that your submit your assignment with enough time before it comes due for you to do a check).
Identifying information: All assignments should include contact information (full name and student ID number) at the very top of your program in the class where the 'main()' function/method resides.
Collaboration: Assignments must reflect individual work, group work is not allowed in this class nor can you copy the work of others. For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
Execution: programs must run on the computer science network. If you write you code in the lab and work remotely using a remote login program such as Putty or SSH. If you choose to install Java on your own computer then it is your responsibility to ensure that your program will run properly here. It's not recommended that you use an IDE for writing your programs but if you use one then make sure that you submit your program in the form of individual text ".java" files (one for each class that you define).
Source code: in order to get any credit for your work you must submit all relevant dot-java files for the assignment (e.g., Driver.java). If you only submit your byte code files (e.g. Driver.class) then you will not be awarded any credit.
D2L configuration for this course

You can (and really should) submit work as many times as you wish before the due date
D2L will only retain whatever files that you submitted the last time that you uploaded to D2L, previous files will not be retained (e.g. if you submit files: A.java, B.java, C.jpg the first time and then you submit A.java the second time then D2L will only have one file stored: A.java. That means that you should submit every file associated with the assignment each time that you want to submit something regardless of how many of those files were actually changed since the last submission.
External libraries that can be used (unless otherwise told don't use external code).
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.

More products