CSCI 140 Project 3
CSCI 140 Project 3
CSCI 140 Project 3
__________________________________________________________
Introduction to Programming Fundamentals with C++ Programming
Project 3
Remember, projects take longer than regular labs do and there is no dedicated lab time for
the projects. I highly recommend starting to work on the projects as soon as you get them and
working on them regularly so you don’t get stuck and forget about them. Neither I nor your
TA may be around at the 23rd hour and it is not our responsibility if you need help and we are
not available the night or the weekend the project is due so work ahead and ask questions
before you need help.
Remember to ask your instructor or TA for help, copying any code from another student or
the internet is against the University dishonesty policy and will result in failing the course.
The year is 2524 and Martians and humans have been interacting on a regular basis, in fact, we have
begun to exchange goods! Unfortunately, the Martian counting system does not directly transfer to
our standard base 10 counting..... it’s ok though, we know C++.
For this assignment you will be writing a program that converts Martian numerals to standard
decimal digits. Please see the rules for Martian numbers below. I have provided some pseudo-code
for the main program, you must write the actual code according to the specifications detailed in this
assignment sheet and the pseudo-code provided.
You will be turning in your program on Canvas, as well as the results of your testing. Remember to
include your name at the top of your code in a comment as well as a brief description of how your
program solves the problem. Also, you should make comments throughout your code to explain
how your program is working.
Goal:
Write a program that will ask users to enter a Martian numeral and then give a decimal conversion.
The program should first determine whether or not the numeral is formatted legally. The largest
number you will have to worry about will be the decimal equivalent of 4999.
2. Martian numerals are written using the symbols above such that the value of these symbols as
you read from left to right never increases. For example: EE is translated as 200.
3. There can never be more than 4 @’s, 1 Z, 4 E’s, 1 &, 4 B’s, 1 W, or 4 S’s because then the
representation is not minimal (e.g. 5 B’s can be written as &).
Once you determine that the number is formatted legally, then your program will actually convert
the number to its decimal equivalent using the values for each digit given above. You do not need to
test for incorrect ordering of digits (ie EESB) but you should say that a Martian numeral is invalid if
©2017, WWU University, All Rights Reserved
CSCI 140 PROJECT 3
__________________________________________________________
the user has included a character that is NOT a valid Martian digit (ie EESJ).
Design:
I have written some pseudo-code for the main program below. It is up to you to write the actual
code for the main program and you must write and use at least one function in your main program.
One useful function might be a convert digit function that takes one char as input and returns the
integer equivalent of that one number using a switch statement. You could potentially use this
function in more than one place in your program, or structure the function to also return a bool
statement.
Pseudo-code:
int main()
{
string martian_number;
For instance if the user types in EEWWS your program should say that it is formatted improperly
(because there are 2 W’s). If the user types in EEWS then your program should output:
EEWS is equal to 206 in decimal digits
Define any other variables you decide are necessary for this program. During
execution, the program must:
No global variables are allowed.
Remember all constants must be in all caps. Review the other naming conventions in the lab
manual as well.
No ‘\n’ allowed, only endl
The only string function allowed is .length(), otherwise, no pre-defined string, cstdlib or
array functions are allowed, like toupper (), if you are unsure of whether or not you
can use one, and would like to, ask the instructor first
Display a program description of what the program will do.
Documentation
1) For each program, be sure to include top of program comments (as specified in course lab
manual and syllabus) that include:
a) Your name, the course, and the assignment number
b) What the Program Does including:
o What is Input
o Processing/Calculations Performed
o What is Output
2) Include clarifying comments beside constants and variable declarations, and in-line, as needed.
Submission
Submit your program source code to the Project 3 folder in the Canvas area of the online
course.
Before submitting your program files, you MUST name them as follows:
Lastname-proj3.cpp
For example:
Smith-proj1.cpp
Grading
The rubric that will be used to grade your program is included on the next pages.
Loop/Menu Asks the user for the data and loops Loops created but does not loop Missing one or two of the loops no loops provided
until all chars are read and counted; around correctly, may end after or menu OR does not stop
Correct loop structure implemented an extra data member is entered looping correctly at all.
or require a second pass to get the
ending value.
Program Input / text Displays descriptive prompt(s) Reads the required input Some kind of prompt issued and Fails to read required input.
files indicating what the user needs to correctly, but does not display data read, but not stored into Hardcoded values used to
provide, and reads the required input appropriate prompt(s) indicating correct variable, or other issues obtain the results or no results
correctly from the text files. what data the user needs to preventing proper use of input obtained.
provide OR reads unnecessary data.
extra input.
Program Logic / The program logic accomplishes all One mathematical equation Multiple mathematical equations Program logic /calculations
Calculations program requirements. Mathematical computes incorrect results, or the compute incorrect results OR accomplish few or none of the
equations compute the correct program logic does not program uses input or hardcoded program requirements.
results. accomplish one of the program value(s) instead of performing a
requirements. computation.
Compilation Code compiles correctly. One or two minor error prevents Multiple minor errors prevent the One or more major errors or a
the code from compiling. code from compiling. multitude of minor errors
prevent the code from
compiling.