Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a code in C language: Financial Aid During Pandemic Prime Minister has announced that the government will give financial aid to reduce the

Please write a code in C language:

Financial Aid During Pandemic

Prime Minister has announced that the government will give financial aid to reduce the burden of the people during the pandemic. Upon this initiation, recipient will receive money with the following amounts:

RM1000 for household category B40

RM600 for household category M40

In this problem, data are given which contains the category, name, and the amount of money received. You are asked to display all data in a category, B40 or M40. Output the information of the recipients in that category, how many recipients are in that category, and the total amount of money for all of the recipients in that category.

Input Format

Input will be given in a file named testdata.in.

The first line consists of an integer .

The next lines consist of the given data.

Each data consists of category, name, and the amount f money received, respectively, separated by commas.

The next line contains the category you want to display, B40 or M40.

Output Format First, for all recipients under the asked category, output the category, name, and the amount of money received. Print in the order from the input.

In the next line, output Total Recipients: , followed by the number of recipients under the asked category.

In the next line, output Total Amount: , followed by the total amount of money for all recipients under the category

Constraints

1 50

Length of name is between 1 and 20 (inclusive). Names consist of upper case Latin alphabet.

Category can only be B40 or M40.

It is guaranteed that the amount of money received is in accordance with the category and the provisions that hae been explained in the description above.

image text in transcribed

Sample Input 6 B40, Sofea, 1000 M40, Mikael, 600 B40, Adam, 1000 B40, Irene, 1000 M40, Cyntia, 600 B40, Alif, 1000 Sample Output B40 Sofea 1000 B40 Adam 1000 B40 Irene 1000 B40 Alif 1000 Total Recipients : 4 Total Amount: 4000 B40 M40 Mikael 600 M40 Cyntia 600 Total Recipients: 2 Total Amount: 1200 6 B40, Sofea, 1000 M40, Mikael, 600 B40, Adam, 1000 B40, Irene, 1000 M40, Cyntia, 600 B40, Alif, 1000 M40

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

Step: 3

blur-text-image

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

Does the code suggest how long data is kept and who has access?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago

Question

=+7 What is the overall cost of the international assignment?

Answered: 1 week ago