Sunday, 19 February 2017

IO 23

QUESTION DESCRIPTION :

Mr.Right is an English teacher , he got task to to calculate a students result

based on input of two examinations ,one sport event , and three activities

conducted . Please help him to find the result of every individual section

according to weightage(Given below) provided by principal that results to

exam percent, sports percent,activities percent and finally total percent

that sums all individual result with following conditions met

Weightage:

ACTIVITIES_WEIGHTAGE- 30
SPORTS_WEIGHTAGE- 20
EXAMS_WEIGHTAGE -50

Total :

EXAMS_TOTAL out of 200
ACTIVITIES_TOTAL out of 60
SPORTS_TOTAL out of 50

Input Format :

Two scores obtained in two examination (out of 100)
The score obtained in sports events (out of 50)
The score obtained in three activities (out of 20)

Explanation :

To calculate exam percent=(Addition of two exam marks)*(Weightage of Exam) /(Total_score based on no of exam inputs).


TEST CASE 1


INPUT

78 89
34
19 18 17


OUTPUT

Result
Total Percent in examination:41.75
Total Percent in activities:27.00
Total Percent in sports:13.60
Total Percentage:82.35


EXPLANATION :

The objective of this code is to evaluate the marks of a student on the basis of the given criteria.The input will be 5 different numbers , first 2 values for exam score, next value for sports score and last 3 values for activity score.The output is the result card which contains individual percentage of the 3 categories and the sum of all three categories as total percentage.

Formula: (To calculate the individual percent of a category)

( Sum of all the scores in that category )*( Weightage of that category )/( Total maximum score of that activity )

example : (Calculating individual % for Activities, sample input : (19,18,17) )

( 19+18+17 )*( 30 )/( 60 )=27.00


ALGORITHM :
  • Accept all 5 inputs from user ( e1,e2,s,a1,a2,a3 )
  • Sum all individual categories ( e1+e2 , s , a1+a2+a3 )
  • Calculate individual percentage using formula ( ep,sp,ap )
  • Calculate total percentage ( ep+ap+sp )
  • Print the result in the expected format correct to 2 decimal places( %0.2f )
SOLUTION : (Please use this as reference only)

CODE





No comments:

Post a Comment