ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 5 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 Apr 2017 My Price 11.00

LAB #2 – File I/O

Can u solve this lab for me dude? Also, gibe me some commends for each part.

 

 

LAB #2 – File I/O
Each lab will begin with a brief demonstration by the TAs for the core concepts examined
in this lab. As such, this document will not serve to tell you everything the TAs will in the
demo. It is highly encouraged that you ask questions and take notes.
As long as you attended lab 1 or received prior permission for missing the lab, then you
can receive any number of points back for finishing the lab prior to this lab #2. Make
sure you get checked off at the beginning of lab #2 for credit!!!
Pair Programming
In this lab, you can choose a partner for pair programming. You must be checked off
together. You only need one computer for pair programming. One person will be the driver,
who controls the computer and codes, while the other is the navigator, who observes and
advises. After 20 minutes, your TA will switch driver and navigator, continuing this pattern until
the task is complete. Please read more about pair programming and the benefits: Pair
Programming Student Handout (3 pts) Design
In this lab, you will read and write to a file. You can copy and paste or download this
example file, input.txt. The input file provides details for a webpage in the following
format:
Title
Background_color
Font_color Font_size Font_face
Contents_of_body
Your program will read specific information from the file and continue reading the
contents of the body from the file until the EOF (end of file) character. You will output
the html to a file called index.html in the public_html directory located in your home
directory. You can specify the relative or absolute path to this directory. The absolute
path is “/nfs/stak/students/u/username/public_html/index.html”, and the relative would
be based on where you are. For example, if you are in a labs directory in a cs162
directory in your home directory, then the relative path is “../../public_html/index.html”.
HTML background:
All html files need to begin and end with <html> and </html> tags. Within these tags
are the header (<head> </head>) and body tags (<body> </body>). The head tag contains title information between the title tags (<title> </title>),
and the head ends before the body begins. The body tag contains background color information, font tags (<font> </font>)
that allow you to control the color, size, and face of the font in the body, and
breaks (<br>) for newlines in the text.
o The body tag contains an attribute called bgcolor. For example:
<body bgcolor=”red”>
o The font tag contains attributes called color, size, and face. For example:
<font color=”white” size=”5” face=”comic sans ms”> o The break tag (<br>) is used to insert a newline in html, and you should
insert one at the end of each line break in your content for the body.
An example output index.html file corresponding to the input.txt file provided would be:
<html>
<head>
<title>My first web page</title>
</head>
<body bgcolor="red">
<font color="white" size="5" face="comic sans ms">
Woohoo! This is my first webpage!<br>
<br>
-Jennifer<br>
<br>
</font>
</body>
</html> You will implement the following functions (with the exact parameters) that read the
specific information from a file and output the information in html format.
void create_header(ifstream &, ofstream &);
void create_body(ifstream &, ofstream &);
void create_html(ifstream &);
Your main function needs to check to make sure the file you open exists before
moving forward. If the file doesn’t exist, then you need to provide an error message and
get a file name that does exist. Write a design for the main function in the driver file, driver.cpp.
Write a design for the create_header(), create_body(), and create_html()
functions in the implementation file, webpage.cpp After 30 minutes, STOP!!!! Your TAs will compare some designs and go over pros and
cons to design. (7 pts) Implementation
Now, implement the driver.cpp, webpage.cpp, and webpage.h files. Create a Makefile
to manage the compilation of all these files.
The first time the index.html file is created, you may need to change permissions to
view the file in your web browser. To change the permissions use chmod.
chmod 664 index.html
View the index.html file using a web browser! http://web.engr.oregonstate.edu/~username/
Remember, you and your partner will not receive lab credit if you do not get
checked off before leaving each lab. Once you have a zero on a lab, then it cannot
be changed because we have no way of know if you were there or not!!!

Attachments:

Answers

(11)
Status NEW Posted 26 Apr 2017 12:04 AM My Price 11.00

-----------

Attachments

file 1493167030-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)