CS 301 - Data Structures and Algorithms I - Spring 2003
Project 1 - C++ fundamentals


Loyola College > Department of Computer Science > CS 301 > Projects > Project 1

Due

Wednesday, February 5th at 11:59pm. Late projects will be assessed a 20% penalty for each day past the due date. Projects will not be accepted more than four days past the due date.

Objectives

Assignment

Convert the given Java program to C++. You should create three files, cubic.h, cubic.cpp, and main.cpp. You should be able to compile your code with the command
g++ -o proj1.x cubic.cpp main.cpp
and then run it with the command
./proj1.cpp

Suggestions

Start by working on the constructors and the parseCubic and toString methods in the Cubic class. Write a small main that tests those methods. If you get stuck on parseCubic, you can have it return an arbitrary value (return Cubic(1.0, 1.0, 1.0, 2.0);) so that you can go on to work on the other parts of the project.

Remember that you will not have to change much of the code. Your primary areas of concern are declations (of objects, methods, and classes), object creation, and I/O.

Useful tools: the sqrt function from cmath to compute square roots; sprintf from cstdio to convert numeric values to C-style strings; atof from cstdlib to do conversions in the other direction; getline from string to read a line from an input stream into a C++ string.

Files

Grading

For full credit, your code must:

Submissions

Submit all of the files you created for this project.