0% found this document useful (0 votes)
3 views4 pages

MArking Scheme DS Lab Assignment 1

The document outlines a lab assessment for Vidyashilp University focusing on data structures, where a cricket league owner named Hari needs to manage player purchases based on auction costs. It details a program that reads player costs, checks if they can be purchased within an initial balance of 2,500,000, and tracks the number of players bought. The assessment also requires verifying if a team of a specified number of players can be successfully formed based on these purchases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

MArking Scheme DS Lab Assignment 1

The document outlines a lab assessment for Vidyashilp University focusing on data structures, where a cricket league owner named Hari needs to manage player purchases based on auction costs. It details a program that reads player costs, checks if they can be purchased within an initial balance of 2,500,000, and tracks the number of players bought. The assessment also requires verifying if a team of a specified number of players can be successfully formed based on these purchases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Vidyashilp University

Data Structures
Lab Assessment 1

22nd Feb 2022

Question : Hari, as an owner in a Cricket League, has received auction amounts for
different players and is currently in the process of team selection. Hari aims to add players
based on his personal preferences and subsequently compute the remaining balance.
Furthermore, he seeks to ascertain the feasibility of forming a team of n players according
to his priority list. Help Hari in verifying whether the team can be successfully formed
based on his preferences.

Requirements:
Step1: Read the number of players (n) to be purchased from the keyboard.
Step2: For each player:

a. Read the cost of the player (cost) purchased by Hari from the keyboard.
b. If the cost is sufficient to purchase the player:
- Display the player's cost.

- Compute and display the balance amount (HariBalanceAmount) Note:


Assume that an initial balance amount (i.e. HariBalanceAmount) value is 2500000

c. If the cost is not sufficient to purchase the player:


- Display the message: "Player can't be purchased by Hari."

- Print the balance amount.


Step3: Print the number of players purchased by Hari
Step4: Check whether the team with n players has been formed successfully and print
the appropriate message.

Complete the following program to satisfy the above requirements

#include <stdio.h>
void main()
{
int n, HariBalanceAmount=2500000,Num_of_Players=0,i;

int cost;
printf("Enter the number of Players to be purchased:\n");
scanf("%d",&n);

for(i=1;i<=n;i++)

{
printf("Enter the cost of Player %d purchased by Hari\n",i);
scanf("%d",&cost); Q1 (0.5)
if(cost<=HariBalanceAmount) or if(HariBalanceAmount>=cost) Q2 (0.5)

{
printf("Player %d Cost =%d\n",i,cost);
HariBalanceAmount= HariBalanceAmount-cost; Q3 (0.5)
printf("Available Balance Amount is %d\n",HariBalanceAmount);

Num_of_Players++;
}
else
{
Q4
printf("Player %d can't be purchased by Hari\n",i); Q4 a. ( 0.25)
printf("Available Balance Amount is %d\n",HariBalanceAmount); Q4 b. (0.25)

}
}
printf("Number of Players Purchased by Hari = %d\n",Num_of_Players);
if(Num_of_Players==n ) Q5 (0.5)

printf("Team with %d Players has been formed successfully\n",n); Q6 a.( 0.25)


(or)
printf("Team with %d Players has been formed successfully\n",Num_of_Players);
else

printf("Team with %d Players has not been formed successfully\n",n); Q6 b.(0.25)


}
Sample Output1

Sample Output2

You might also like