Absolute C++
Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 11PP

(This is an extension of an exercise from Chapter I.) A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5 feet of height and 5 pounds for each additional inch. Create the following text in a text file. It contains the names and heights in feet and inches of Tom Atto Eaton Wright ( 5 ' 5 " ) , and Cary Oki ( 5 ' 11 " ) :

( 6 ' 3 " ) ,

Tom Atto

6

3

Eaton Wright

5

5

Cary Oki

5

11

Write a program that reads the data in the file and outputs the full name and ideal body weight for each person. Use a loop to read the names from the file. Your program should also handle an arbitrary number of entries in the file instead of handling only three entries.

Blurred answer
Students have asked these similar questions
Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Read in each account number and display whether it is valid. An account number is valid only if the last digit is equal to the remainder when the sum of the first five digits is divided by 10. For example, the number 223355 is valid because the sum of the first five digits is 15, the remainder when 15 is divided by 10 is 5, and the last digit is 5. Write only valid account numbers to an output file, each on its own line.*Note that the contents of the file AcctNumsIn.txt will change when the test is run to test the program against different input.   AcctNumsIn.txt 345619789400871208901156984334723422172257100000273699237485761200555500936716763542999995     import java.nio.file.*;import java.io.*;import java.nio.channels.FileChannel;import java.nio.ByteBuffer;import static java.nio.file.StandardOpenOption.*;public class ValidateCheckDigits {public static void main(String[] args) {Path…
Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Read in each account number and display whether it is valid. An account number is valid only if the last digit is equal to the remainder when the sum of the first five digits is divided by 10. For example, the number 223355 is valid because the sum of the first five digits is 15, the remainder when 15 is divided by 10 is 5, and the last digit is 5. Write only valid account numbers to an output file, each on its own line.*Note that the contents of the file AcctNumsIn.txt will change when the test is run to test the program against different input.   AcctNumsIn.txt345619789400871208901156984334723422172257100000273699237485761200555500936716763542999995   ValidateCheckDigits.javaimport java.nio.file.*;import java.io.*;import java.nio.channels.FileChannel;import java.nio.ByteBuffer;import static java.nio.file.StandardOpenOption.*;public class ValidateCheckDigits {public static void…
Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Read in each account number and display whether it is valid. An account number is valid only if the last digit is equal to the remainder when the sum of the first five digits is divided by 10. For example, the number 223355 is valid because the sum of the first five digits is 15, the remainder when 15 is divided by 10 is 5, and the last digit is 5. Write only valid account numbers to an output file, each on its own line. Note that the contents of the file AcctNumsIn.txt will change when the test is run to test the program against different input.

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
What is the general problem with static scoping?

Concepts of Programming Languages (11th Edition)

Give an example of a data constraint.

Database Concepts (7th Edition)

The ___________ member function returns a files current write position.

Starting Out with C++ from Control Structures to Objects (9th Edition)

Suppose the class F is defined in (a). Let f be an instance of F. Which of the statements in (b) are correct?

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License