Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Functional Programming Use: C++ Functional programming is all about composition. To compose functions, they need to return a type; you cannot compose functions that don't

Functional Programming

Use: C++ Functional programming is all about composition. To compose functions, they need to return a type; you cannot compose functions that don't return anything (i.e. void).

Q: Write a program that reads table with given columns from input stream. Columns are name(note: firstname and lastname are in one column, so use getline maybe), amount, debt. Then filter the table (condition: debt is equal to 0). After that increase debt by 42% then print results.

Input:

5 Solomon Anderson 411889 36881 Jill Mitten 121877 0 Katie Nicholson 783887 591951 Ben Hen 445511 0 Adam Millington 818507 276592

Output:

Solomon Anderson 411889 52371.02 Katie Nicholson 783887 840570.42 Adam Millington 818507 392760.64

-----------------------------------------------------------------------------------

Think of what you need:

- you need to know how many lines of input you have

- convert N lines of input into some form of list with N elements

- filter a list of N such elements and reduce it to a list with M elements

- modify that list (commonly referred to as "map" the list) - you need to print the list.

So you should get print( map( filter( readLines( getInputSize() ) ) ) ) in the main section.

**PLEASE READ CAREFULLY BEFORE ANSWERING**

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

6. Describe to a manager the different types of distance learning.

Answered: 1 week ago

Question

1. Explain how new technologies are influencing training.

Answered: 1 week ago