Project II - Computer Science - Fall 2006 | CS 23021, Study Guides, Projects, Research of Computer Science

Material Type: Project; Professor: Volkert; Class: CS I PROG/PROBLEM SOLVING; Subject: Computer Science; University: Kent State University; Term: Fall 2006;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 02/25/2010

koofers-user-p1e-1
koofers-user-p1e-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS23021 Computer Science I
Fall 2006, Project #2
Committed by 11:59pm on Tuesday, October 3, 2006
Preliminaries
Write a program that inputs multiple lines of integer numb ers and outputs them in an HTML table. The negative
numbers should be output in red color. The numbers should be printed 3 in a row, one number per column. The
fourth column should contain th e sum of the numbers in th e row. If the sum is negative it should be outpu t in red.
Input stops when 0 (zero) is entered. Zero should not be ou tput. Empty cells should be output to complete the table
if necessary. The last row should contain the sum of all n umbers in each respective column and the total of all
numbers. An example table is provided. As a starting point you can use the example program that just inputs th e
numbers and outputs them without change.
HTML (HyperText Markup Language) is the languag e that is used in writing web-pages. The language consists of
formatting elements called HTML tags. HTML table starts with a <table> tag and ends with a </table> tag.
The information in the table in entered by rows. Every table row starts w ith a <tr> and ends w ith a </tr>. The
rows are divided in to table cells. Ev ery cell starts with a <td> and ends with a </td>. Information enter ed in the
table cell is formatted and displayed. The color with which content is output is controlled by the <font> and
</font> tag p air. For example, <font color=red> hello, world </font> displays “hello, world ” in
the color red in a browser. More on H TML can be found at the following location:
http://www.mcs.kent.edu/system/web_help/index.html
An example table is stored in file the example.html, and is supplied with the project assignm ent. You can view
this file in a browser by clicking on it. While working on your own tables you can always view them in a browser by
downloading th em to your computer and opening them in the browser (Netscape) by selecting “File”“Open” from
the pull-down menu of your browser.
The program should receive the input from standard input, and output to standard output. Both can be redirected,
using the unix/linux redirect operators . For example, the command:
prompt% table < inputfile > table.html
makes program table input from file inputfile and then all the output of table is stored in file table.html
The file table.html can be viewed in a browser. Note, that if you are using gdb to debug your program you can
use the debugger’s run command to redirect your input/output:
(gdb) run < inputfile > table.html
Assignment
Check out the project files from http:/ /classes.cs.kent.edu/svn/cs23021/volkert/cs23021_shared/Project2/
File exampleinput contains an example inpu t file that the program processes. Note, that your program has to
work on any line of numbers not only on the numbers specified in exampleinput. Test your program with
different inpu t integer sequences. Wr ite a C++ program table.cpp such that it outputs the numbers input in an
HTML table three numbers in a row. You can use the provided example.cpp program as a starting point. Note,
that example.cpp is nothing but a working template and you have to sign ificantly add and modify i ts behavior.
The negative numbers should be output so that they display in the color red. You are not allowed to use functions
or arrays (material that we have not studied). You are only allowed to use branching and looping constructs as the
control operators.
Make sure that your modified program contains co mments and otherwise adheres to good program style. The link to
programming style guide is available on the course’s webpage. Your grade will be lowered if your do not follow the
programming style guidelines outlined there.

Partial preview of the text

Download Project II - Computer Science - Fall 2006 | CS 23021 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CS23021 Computer Science I

Fall 2006, Project

Committed by 11:59pm on Tuesday, October 3, 2006

Preliminaries

Write a program that inputs multiple lines of integer numbers and outputs them in an HTML table. The negative numbers should be output in red color. The numbers should be printed 3 in a row, one number per column. The fourth column should contain the sum of the numbers in the row. If the sum is negative it should be output in red. Input stops when 0 (zero) is entered. Zero should not be output. Empty cells should be output to complete the table if necessary. The last row should contain the sum of all numbers in each respective column and the total of all numbers. An example table is provided. As a starting point you can use the example program that just inputs the numbers and outputs them without change. HTML (HyperText Markup Language) is the language that is used in writing web-pages. The language consists of formatting elements called HTML tags. HTML table starts with a

tag and ends with a
tag. The information in the table in entered by rows. Every table row starts with a and ends with a . The rows are divided into table cells. Every cell starts with a and ends with a . Information entered in the table cell is formatted and displayed. The color with which content is output is controlled by the and tag pair. For example, hello, world displays “hello, world” in the color red in a browser. More on HTML can be found at the following location: http://www.mcs.kent.edu/system/web_help/index.html An example table is stored in file the example.html, and is supplied with the project assignment. You can view this file in a browser by clicking on it. While working on your own tables you can always view them in a browser by downloading them to your computer and opening them in the browser (Netscape) by selecting “File”→“Open” from the pull-down menu of your browser. The program should receive the input from standard input, and output to standard output. Both can be redirected, using the unix/linux redirect operators. For example, the command: prompt% table < inputfile > table.html makes program table input from file inputfile and then all the output of table is stored in file table.html The file table.html can be viewed in a browser. Note, that if you are using gdb to debug your program you can use the debugger’s run command to redirect your input/output: (gdb) run < inputfile > table.html

Assignment

Check out the project files from http://classes.cs.kent.edu/svn/cs23021/volkert/cs23021_shared/Project2/ File exampleinput contains an example input file that the program processes. Note, that your program has to work on any line of numbers not only on the numbers specified in exampleinput. Test your program with different input integer sequences. Write a C++ program table.cpp such that it outputs the numbers input in an HTML table three numbers in a row. You can use the provided example.cpp program as a starting point. Note, that example.cpp is nothing but a working template and you have to significantly add and modify its behavior. The negative numbers should be output so that they display in the color red. You are not allowed to use functions or arrays (material that we have not studied). You are only allowed to use branching and looping constructs as the control operators. Make sure that your modified program contains comments and otherwise adheres to good program style. The link to programming style guide is available on the course’s webpage. Your grade will be lowered if your do not follow the programming style guidelines outlined there.