TCS CPA Unix Solution | Xplore UNIX CPA Solution | Calculate Total Asset Price | 27 March

by Python EveryDay in Circuits > Linux

12526 Views, 1 Favorites, 0 Comments

TCS CPA Unix Solution | Xplore UNIX CPA Solution | Calculate Total Asset Price | 27 March

TCS CPA UNIX Solution | EASIEST METHOD EVER!! | Xplore Unix Questions and Solution | TCS | Part 2

Unix CPA 27 March Calculate Total Asset Price

Asset details belonging to each department are stored in a file in the following format, Each field is comma (,)separated.

AssetName,AssetType,Department, AssetPrice

Write the UNIX command to find the total price of assets belonging to Finance department.

The output should be displayed in below format,

Total Asset Price = <"total price calculated">

In case there are no assets found belonging to Finance department, the displayed output should be "No Asset Found" excluding the quotes.

Refer to the examples below for more clarity on input and output format.

The file name input will be provided as command line argument when the script containing your command will run. You can use shell variables (e.g. $0,$1,$2) whichever is applicable for your requirement to provide the command line argument .

Note : the search for department should be case insensitive

Example 1:
Input:

AssetName,AssetType,Department,AssetPrice
lap1,laptop,finance,50000
desk1,desktop,Finance,40000
lap2,laptop,IT,70000
desk2,desktop,IT,80000
prn1,printer,Finance,10000
prn2,printer,HR,20000

Output:

Total Asset Price = 100000

Example 2:
Input:

AssetName,AssetType,Department,AssetPrice
lap1,laptop,admin,50000
des1,desktop,admin,40000
lap2,laptop,IT,70000
des2,desktop,IT,80000
prn1,printer,helpdesk, 10000
prn2,printer,HR,20000

Output:

No Asset Found

For Solution : Detailed Solution, Click Here

Python EveryDay!!!

Q1_1.JPG

Q1_2.JPG

Q1_3.JPG