Mumber of Novels Authored Author Jane Austen Charles Dickens Ernest Hemingway Jack Kerouac Number of Titles 20 22

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Program in C++

author_titles_data.txt file

Jane Austen; 6
Charles Dickens; 20
Ernest Hemingway; 9
Jack Kerouac; 22
F. Scott Fitzgerald; 8
Mary Shelley; 7
Charlotte Bronte; 5
Mark Twain; 11
Agatha Christie; 73
Ian Fleming; 14
J.K. Rowling; 14
Stephen King; 54
Oscar Wilde; 1

The program will get its data from the input file authorn Vedatatet. This file can be accessed from your lab program. It can also be
downloaded so you can review its contents.
The file contains many lines of information about book authors. Each line is formatted as an author's full name, samicolon, and the number
of books the author has written
John F. Kennedy; 12
Your program will read the file into a program, manipulate the data, and create a formatted table from the data and a calculation
The template gives you a start of the program. There are several new concepts in this template.
The menu illustrates the progression that a programmer develops a complicated program like this. It lets you create this program in
steps and test each step
It is very occasionally a good idea to create global constants. The formatting constants will be used in multiple functions in this
program somaking them global is a good idea.
The albemate way of creating programmer defined functions in C++ appears for the first time this semester. The function prototypes
appear before the definition of main. The function definitions then appear after main(). You'll leam much more about this in CSP
Develop your program in p
(1) Read the first line of the file and redisplay it to the output window
(2) Figure out how to get the full name from the first line of the file. Display the full name to the output window. You'll probably copy and
past the code from step (1) into this function as your starting point.
(3) Figure out how to get the number of books from the first line of the file AS AN INTEGER (HINT: will be useful.) Display the first author's
information in the minimal format from the menu.
(4) Repeat step (3) for every line of the input file
Charlotte Bronte 5
Mark Twain
11
Agatha Christie 73
Ian Fleming
14
3.K. Rowling 14
(5) Now formally format the table. There will be a leff justified title line. The column widths are defined by the global constants. The name
column is left-justified and the number of books column is right-justified. The two columns are separated by a single vertical line character
Ex
Number of Novels Authored
Author N
Jane Austen
Charles Dickens
Ernest Hemingway
Jack Kerouac
Number of Titles
6
22
(6) The last feature is to determine the integer average number of books per author in the file. Display the fully formatted table from step (5)
along with two more lines at the bottom
Ex
Average titles
One more thing. Your program must work for any data file that has the same format as authorsnedatatet Your solution must not depend
on any of the specifics of this particular version of this file, like its number of lines or the total of all the titles
18
Transcribed Image Text:The program will get its data from the input file authorn Vedatatet. This file can be accessed from your lab program. It can also be downloaded so you can review its contents. The file contains many lines of information about book authors. Each line is formatted as an author's full name, samicolon, and the number of books the author has written John F. Kennedy; 12 Your program will read the file into a program, manipulate the data, and create a formatted table from the data and a calculation The template gives you a start of the program. There are several new concepts in this template. The menu illustrates the progression that a programmer develops a complicated program like this. It lets you create this program in steps and test each step It is very occasionally a good idea to create global constants. The formatting constants will be used in multiple functions in this program somaking them global is a good idea. The albemate way of creating programmer defined functions in C++ appears for the first time this semester. The function prototypes appear before the definition of main. The function definitions then appear after main(). You'll leam much more about this in CSP Develop your program in p (1) Read the first line of the file and redisplay it to the output window (2) Figure out how to get the full name from the first line of the file. Display the full name to the output window. You'll probably copy and past the code from step (1) into this function as your starting point. (3) Figure out how to get the number of books from the first line of the file AS AN INTEGER (HINT: will be useful.) Display the first author's information in the minimal format from the menu. (4) Repeat step (3) for every line of the input file Charlotte Bronte 5 Mark Twain 11 Agatha Christie 73 Ian Fleming 14 3.K. Rowling 14 (5) Now formally format the table. There will be a leff justified title line. The column widths are defined by the global constants. The name column is left-justified and the number of books column is right-justified. The two columns are separated by a single vertical line character Ex Number of Novels Authored Author N Jane Austen Charles Dickens Ernest Hemingway Jack Kerouac Number of Titles 6 22 (6) The last feature is to determine the integer average number of books per author in the file. Display the fully formatted table from step (5) along with two more lines at the bottom Ex Average titles One more thing. Your program must work for any data file that has the same format as authorsnedatatet Your solution must not depend on any of the specifics of this particular version of this file, like its number of lines or the total of all the titles 18
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
System Management Strategies
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr