Day 2 - Slot 1 (8 AM to 11 AM)
Question 1
We want to estimate the cost of painting a property. Interior wall painting cost is 18 per square feet and exterior wall painting cost is 12 per square feet.
Take input as:
- Number of interior Walls
- Number of exterior Walls
- Surface Area of each Interior Wall in units of square feet.
- Surface Area of each Exterior Wall in units of square feet.
If user enters zero as number of walls then skip Surface are values as User may don't want to paint the walls. Calculate and display the total cost of painting the property.
Test Case 1
Input :
6
3
12.3
15.2
12.3
15.2
12.3
15.2
10.10
10.10
10.00
Output :
Total estimated Cost : 1847.4 INR
Note :
Follow input and output format as given in above example.
Answer
Output
Question 2
A City Bus is a Ring Route Bus that runs in a circular fashion. That is, Bus once starts at the Source Bus Stop, halts at each Bus Stop in its Route and at the end, it reaches the Source Bus Stop again.
If there are n number of Stops and if the bus starts at Bus Stop 1, then after nth Bus Stop, the next stop in the Route will be Bus Stop number 1 always.
If there are n stops, there will be n paths.One path connects two stops. Distances (in meters) for all paths in Ring Route is given in array Path[] as given below:
Path = [800, 600, 750, 900, 1400, 1200, 1100, 1500]
Fare is determined based on the distance covered from source to destination stop as Distance between Input Source and Destination Stops can be measured by looking at values in array Path[] and fare can be calculated as per the following criteria:
If d =1000 meters, then fare=5 INR
(When calculating fare for others, the calculated fare containing any fraction value should be ceiled. For example, for distance 900n when fare initially calculated is 4.5 which must be ceiled to 5)
The path is circular in function. Value at each index indicates distance till the current stops from the previous one. And each index position can be mapped with values at the same index in BusStops [] array, which is a string array holding abbreviation of names for all stops as-
“THANERAILWAYSTN” = ”TH”, “GAONDEVI” = “GA”, “ICEFACTROY” = “IC”, “HARINIWASCIRCLE” = “HA”, “TEENHATHNAKA” = “TE”, “LUISWADI” = “LU”, “NITINCOMPANYJUNCTION” = “NI”, “CADBURRYJUNCTION” = “CA”
Given, n=8, where n is a number of total BusStops.
BusStops = [ “TH”, ”GA”, ”IC”, ”HA”, ”TE”, ”LU”, ”NI”,”CA” ]
Write a code with function get are(String Source, String Destination) which takes Input as the source and destination stops(in the format containing first two characters of the Name of the Bus Stop) and calculate and return travel fare.
Example 1:
Input Values
ca
Ca
Output Values
INVALID OUTPUT
Example 2:
Input Values
NI
HA
Output Values
23.0 INR
Note: Input and Output should be in the format given in the example.
Answer
Output
Stay tuned
0 Comments