Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

OUTCOME BASED LAB

TASK REPORT

APPLICATION FOR PARKING CHARGES


OUTCOME BASED LAB TASK REPORT

Submitted by
ARVIND N

BANNARI AMMAN INSTITUTE OF TECHNOLOGY


(An Autonomous Institution Affiliated to Anna University, Chennai)
SATHYAMANGALAM-638401

APRIL 2020
DECLARATION

I affirm that the lab task work titled “APPLICATION FOR PARKING CHARGES AND
ANALYSIS OF CRICKET TEST SERIES” being submitted as the record of original
work done by us under the guidance of Mrs.THARSANEE R M Assistant Professor,
Department of Computer Science and Engineering.

ARVIND N
(181CS121)

I certify that the declaration made above by the candidates is true.

(Signature of the Guide)


Mrs. THARSANEE R M
TABLE OF CONTENTS

CHAPTER NO. TITL PAGE


E NO.

1. INTRODUCTION

1.1 INTRODUCTION 5
1.2 PROBLEM STATEMENT. 5
1.3 ALGORITHM 5
2.
WORKING OF PROJECT
2.1 SOURCE CODE 5

2.2 OUTPUT 9

3. RESULTS

3.1 CONCLUSION 10

4. WORKING OF PROJECT

4.1 SOURCE CODE 11

4.2 OUTPUT 18

5
. RESULTS

5.1 CONCLUSION
22
PART 1

INTRODUCTION
In a cricket match runs scored by the players is calculated manually to produce result of
the player. This project can be used to calculate the average runs scored by player, individual
player score, and highest score of individuals from the series played so far. This project
calculates it accurate and faster.

PROBLEM STATEMENT
An Analysis report for the Test Series match need to be generated from the given Test
series result

ALGORITHM

Step 1: Start
Step 2: Get number of players
Step 3: Get Individual player test score.
Step 4 Find High Score of an individual from the series played so far.
Step 5: Identify the player who have score from the obtained input.
Step 6: Display the number of series played along with the mean score of all the players
Step 7: Display the average score of each player in addition to that with the help of the
above mean score it should display whether a player is ABOVE/BELOW average, which says
about the player’s performance.
Step 8: As a last part of analysis Display the best player by considering the average score
calculated as above.
Step 9: Stop
SOURCE CODE
import java.util.*;
class Main {
public static void main(String[] args) {
Series ob=new Series();
System.out.println("-----------------------------------------------");
System.out.println("\t\t\tFETCHING DETAILS");
System.out.println("-----------------------------------------------");
ob.playerDetails();
System.out.println("------------------------------------------------------------");
System.out.println(" HIGH SCORE OF AN INDIVIDUAL FROM THE SERIES PLAYED SO FAR");
System.out.println("------------------------------------------------------------");
ob.bestScore();
System.out.println("-----------------------------------------------");
System.out.println("\t\t\tANALYSIS REPORT");
System.out.println("-----------------------------------------------");
ob.num_ser();
System.out.println("----------------MEAN SCORE-------------------");
ob.playerAvgStatus();
}
}
abstract class Match
{
abstract void bestScore();
abstract void num_ser();
abstract void playerAvgStatus();
abstract void bestPlayer(float plmean[]);

}
interface player
{
int max_players=10;
void playerDetails();
void score(int pl_tid,int ns);
}
class Series extends Match implements player
{
int num_play;
static int scores[][],tot_sc,tot_ser;
Scanner in=new Scanner(System.in);
Series()
{
System.out.print("Enter number of players: ");
num_play=in.nextInt();
if(num_play<2)
throw new ArithmeticException("Minimum 2 Players are required!");
else if(num_play>max_players)
throw new ArithmeticException("More than Maximum Players!");
scores=new int[num_play][10];
for(int i=0;i<num_play;i++)
for(int j=0;j<10;j++)
scores[i][j]=-1;
}
public void playerDetails()
{
int i,ns;
for(i=0;i<num_play;i++)
{
System.out.print("Enter number of series played by Player "+(i+1)+" : ");
ns=in.nextInt();
score(i,ns);

}
}
public void score(int pl_tid,int ns)
{
int val;
System.out.println("Enter Player "+(pl_tid+1)+" match details");
for(int i=0;i<ns;i++)
{
System.out.print("Series "+(i+1)+ " : ");
val=in.nextInt();
if(val<0)
throw new ArithmeticException("Score can't be less than 0.");
else
{scores[pl_tid][i]=val;tot_sc+=val;}
}
}
void bestScore()
{
int i,max=-1,j,high=-1,pl_id=0;
for(i=0;i<num_play;i++)
{
max=-1;
for(j=0;j<10;j++)
if (scores[i][j]>max)
max=scores[i][j];
System.out.println("BEST SCORE OF PLAYER "+(i+1)+" is : "+max);
if(max>high)
{high=max;pl_id=i+1;}
}
System.out.println("------------HIGH SCORE-------------");
System.out.println("PLAYER WITH HIGHEST SCORE --> PLAYER "+pl_id+" WITH AN OVERALL
SCORE OF --> "+high);
}
void num_ser()
{
int i,j;
for(i=0;i<num_play;i++)
{
for(j=0;j<10;j++)
if(scores[i][j]==-1)
break;
System.out.println("Number of Series played by Player "+(i+1)+" is "+j);
tot_ser+=j;
}
}
void playerAvgStatus()
{
int i,j,pl_tot=0;
float mean,val_mean, pl_mean[]=new float[num_play];
mean=tot_sc/tot_ser;
System.out.println("Mean Score of All Players = "+mean);
System.out.println("----------------------------------------------");
for(i=0;i<num_play;i++)
{
pl_tot=0;
for(j=0;j<10;j++)
{
if (scores[i][j]>-1)
pl_tot+=scores[i][j];
else if(scores[i][j]==-1)
break;
}
val_mean=pl_tot/(float)j;
pl_mean[i]=val_mean;
System.out.println("Average Score of Player "+(i+1)+" : "+val_mean +" which is
"+plavg(val_mean,mean) +" Average");
}
System.out.println("-------BEST PLAYER-----------");
bestPlayer(pl_mean);
}
String plavg(float pl_mean,float mean)
{
if(pl_mean>mean)
return "ABOVE";
else if(pl_mean<mean)
return "BELOW";
else
return "EQUAL TO";
}
void bestPlayer(float plmean[])
{
int i,pid=0; float max=0,val;
for(i=0;i<plmean.length;i++)
{
val=plmean[i];
if(val>max)
{
max=val;
pid=i+1;
}
}
System.out.println("BEST PLAYER --> AWARDED TO --> PLAYER "+pid+" WITH AN OVERALL
SCORE OF --> "+max);
}
}
OUTPUT
Enter number of players: 3
-----------------------------------------------
FETCHING DETAILS
-----------------------------------------------
Enter number of series played by Player 1 : 5
Enter Player 1 match details
Series 1 : 98
Series 2 : 121
Series 3 : 127
Series 4 : 157
Series 5 : 86
Enter number of series played by Player 2 : 2
Enter Player 2 match details
Series 1 : 67
Series 2 : 89
Enter number of series played by Player 3 : 4
Enter Player 3 match details
Series 1 : 67
Series 2 : 88
Series 3 : 76
Series 4 : 145
------------------------------------------------------------
HIGH SCORE OF AN INDIVIDUAL FROM THE SERIES PLAYED SO FAR
------------------------------------------------------------
BEST SCORE OF PLAYER 1 is : 157
BEST SCORE OF PLAYER 2 is : 89
BEST SCORE OF PLAYER 3 is : 145
------------HIGH SCORE-------------
PLAYER WITH HIGHEST SCORE --> PLAYER 1 WITH AN OVERALL SCORE OF
--> 157
-----------------------------------------------
ANALYSIS REPORT
-----------------------------------------------
Number of Series played by Player 1 is 5
Number of Series played by Player 2 is 2
Number of Series played by Player 3 is 4
----------------MEAN SCORE-------------------
Mean Score of All Players = 101.0
----------------------------------------------
Average Score of Player 1 : 117.8 which is ABOVE Average
Average Score of Player 2 : 78.0 which is BELOW Average
Average Score of Player 3 : 94.0 which is BELOW Average
-------BEST PLAYER-----------
BEST PLAYER --> AWARDED TO --> PLAYER 1 WITH AN OVERALL SCORE OF
--> 117.8
CONCLUSION
This project can be used in the cricket match evaluation to select best player for the
match. This reduces the manual calculation time of evaluators and helps to pick the best player.
PART 2
INTRODUCTION
In large Mall parking system are managed a person or using some kind of things to
manage their parking slots. This project can be used in parking systems to calculate the charge
for parking and it also used to say the customer about the parking details.
PROBLEM STATEMENT
A SKYWORLD Mall chairperson plan to construct the mall with FOUR floors along
with TWO Parking floors at the basement. As the Mall has variety of shops, in daily basis
the number of people enjoying in the mall increases. They want to design an application,
which calculates the Parking Charge

ALGORITHM
Step 1: Start
Step 2: Get vehicle details from the customer
Step 3: Get how many hours did the vehicle parked.
Step 4: For each type of vehicle different charge will be applied to the customer
Step 5: If it is a weekend the charges will be different.
Step 6: Print the charge to the customer.
Step 7: If the parking slot is filled, display the user as parking filled
Step 8: At end display the parking slot details.
Step 9: Stop

SOURCE CODE
import java.util.*;
class weekend_charge
{
static int max_car,max_bus,max_twow;
weekend_charge(int a, int b,int c)
{
max_car=a;
max_bus=b;
max_twow=c;
}
weekend_charge()
{}
void charge_paid(int hours,int rate,int excess)
{
System.out.println("-----AMOUNT TO BE PAID-----");
System.out.println("CHARGES="+(hours*rate+excess));
}
void t_charge(int hours)
{}

}
class Car extends weekend_charge
{
int ncar;
Car(int n)
{
super(2,2,2);
ncar=n;
}
void charge_paid(int hours)
{
if(hours<=2)
super.charge_paid(hours,5,0);
else
super.charge_paid(hours,5,10);
}
void t_charge(int hours)
{
System.out.println("-----AMOUNT TO BE PAID-----");
if(hours<=2)
System.out.println("Charges="+(hours*5));
else
System.out.println("Charges="+(hours*10+10));
}
}
class Bus extends weekend_charge
{
int nbus;
Bus(int n)
{
nbus=n;
}
void charge_paid(int hours)
{
if(hours<=2)
super.charge_paid(hours,8,0);
else
super.charge_paid(hours,20,5);
}
void t_charge(int hours)
{
System.out.println("-----AMOUNT TO BE PAID-----");
if(hours<=3)
System.out.println("Charges=5");
else
System.out.println("Charges="+(hours*15+5));
}
}
class Twowheeler extends weekend_charge
{
int ntwow;
Twowheeler(int n)
{
ntwow=n;
}

void charge_paid(int hours)


{
if(hours<=3)
super.charge_paid(hours,0,0);
else
super.charge_paid(hours,8,0);
}
void t_charge(int hours)
{
System.out.println("-----AMOUNT TO BE PAID-----");
if(hours<=3)
System.out.println("Charges=0");
else
System.out.println("Charges="+hours*5);
}
}
class Main {
// This class should be renamed as Car_Parking
public static void main(String[] args)
{
Car c=new Car(0);
Bus b=new Bus(0);
Twowheeler tw=new Twowheeler(0);
Scanner in = new Scanner(System.in);
char type, wish;
int vt,hp;
do
{
System.out.println("\n\n---------------------------------");
System.out.println("-----AVAILABLE PARKING SLOTS-----");
if(c.ncar<c.max_car)
System.out.println("1. CAR");
else
System.out.println("1. CAR ---> PARKING FULL");
if(tw.ntwow<tw.max_twow)
System.out.println("2. TWO WHEELER");
else
System.out.println("2. TWO WHEELER ---> PARKING FULL");
if(b.nbus<b.max_bus)
System.out.println("3. BUS/VAN");
else
System.out.println("3. BUS/VAN ---> PARKING FULL");
System.out.println("\nChoose the type of vehicle:");
vt=in.nextInt();
System.out.println("Number of hours parked:");
hp=in.nextInt();
System.out.println("Is it a weekend (Y/N):");
type=in.next().charAt(0);
System.out.println("-----VEHICLE DETAILS-----");
switch(vt)
{
case 1:
System.out.println("VEHICLE TYPE : CAR");
System.out.println("NUMBER OF HOURS PARKED : "+hp+"\n");
c.ncar++;
if(type=='y'||type=='Y')
c.charge_paid(hp);
else
c.t_charge(hp);
break;
case 2:
System.out.println("VEHICLE TYPE : TWO WHEELER");
System.out.println("NUMBER OF HOURS PARKED : "+hp+"\n");
tw.ntwow++;
if(type=='y'||type=='Y')
tw.charge_paid(hp);
else
tw.t_charge(hp);
break;
case 3:
System.out.println("VEHICLE TYPE : BUS/VAN");
System.out.println("NUMBER OF HOURS PARKED : "+hp+"\n");
b.nbus++;
if(type=='y'||type=='Y')
b.charge_paid(hp);
else
b.t_charge(hp);
break;
}
System.out.println("THANKYOU VISIT AGAIN");
System.out.println("Do you wish to continue? (Y/N)");
wish=in.next().charAt(0);
}while(wish=='y'||wish=='Y');
System.out.println("Number of Vehicles at Car Parking : "+c.ncar);
System.out.println("Number of Vehicles at Two Wheeler Parking : "+tw.ntwow);
System.out.println("Number of Vehicles at Bus/Van Parking : "+b.nbus);
}
}

OUTPUT
---------------------------------
-----AVAILABLE PARKING SLOTS-----
1. CAR
2. TWO WHEELER
3. BUS/VAN

Choose the type of vehicle:


1
Number of hours parked:
2
Is it a weekend (Y/N):
N
-----VEHICLE DETAILS-----
VEHICLE TYPE : CAR
NUMBER OF HOURS PARKED : 2

-----AMOUNT TO BE PAID-----
Charges=10
THANKYOU VISIT AGAIN
Do you wish to continue? (Y/N)
Y
---------------------------------
-----AVAILABLE PARKING SLOTS-----
1. CAR
2. TWO WHEELER
3. BUS/VAN

Choose the type of vehicle:


1
Number of hours parked:
55
Is it a weekend (Y/N):
YY
-----VEHICLE DETAILS-----
VEHICLE TYPE : CAR
NUMBER OF HOURS PARKED : 55

-----AMOUNT TO BE PAID-----
CHARGES=285
THANKYOU VISIT AGAIN
Do you wish to continue? (Y/N)
Y
---------------------------------
-----AVAILABLE PARKING SLOTS-----
1. CAR ---> PARKING FULL
2. TWO WHEELER
3. BUS/VAN

Choose the type of vehicle:


1
Number of hours parked:
6
Is it a weekend (Y/N):
Y
-----VEHICLE DETAILS-----
VEHICLE TYPE : CAR
NUMBER OF HOURS PARKED : 6

-----AMOUNT TO BE PAID-----
CHARGES=40
THANKYOU VISIT AGAIN
Do you wish to continue? (Y/N)
Y
---------------------------------
-----AVAILABLE PARKING SLOTS-----
1. CAR ---> PARKING FULL
2. TWO WHEELER
3. BUS/VAN

Choose the type of vehicle:


3
Number of hours parked:
4
Is it a weekend (Y/N):
Y
-----VEHICLE DETAILS-----
VEHICLE TYPE : BUS/VAN
NUMBER OF HOURS PARKED : 4

-----AMOUNT TO BE PAID-----
CHARGES=85
THANKYOU VISIT AGAIN
Do you wish to continue? (Y/N)
Y
---------------------------------
-----AVAILABLE PARKING SLOTS-----
1. CAR ---> PARKING FULL
2. TWO WHEELER
3. BUS/VAN

Choose the type of vehicle:


2
Number of hours parked:
4
Is it a weekend (Y/N):
Y
-----VEHICLE DETAILS-----
VEHICLE TYPE : TWO WHEELER
NUMBER OF HOURS PARKED : 4
-----AMOUNT TO BE PAID-----
CHARGES=32
THANKYOU VISIT AGAIN
Do you wish to continue? (Y/N)
N
Number of Vehicles at Car Parking : 3
Number of Vehicles at Two Wheeler Parking : 1
Number of Vehicles at Bus/Van Parking : 1
CONCLUSION
This project can be used in the malls to calculate the charges in the parking slot. This
makes faster for calculations and getting details about the parking.

You might also like