AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Program to find runrate

In the first 10 overs of India Innings, the run rate was only 3.2. Find the required run rate in the remaining 40 overs to reach the target of 282 runs.

Total overs : 50

Total balls in an over: 6

Run rate formula: total runs scored/total overs faced

NOTE: Answer should be upto two decimal places.

import java.util.*;
class RunRate
{
public static void main(String[] args)
{
double tr=282; //total runs scored
double crr=3.2f; // current runrate upto 10 overs
double co=10,po=40,rrr,x; //completed overs,remaining overs,required runrate,x.
rrr=((tr-(crr*co))/po); // claculating required run rate
x=Math.round(rrr*1e2)/1e2; // rounding decimal upto 2 points
System.out.println(x); //output
}
}

corejava x 333
programming x 150
Posted On : 2016-06-13 09:34:18.0
profile syed_lathif - anyforum.in syed_lathif
23330
up-rate
4
down-rate

Answers


import java.util.Scanner;

public class Runrate {
public static void main(String[] args) {
System.out.println("Enter the runrate till 10 overs");
Scanner input=new Scanner(System.in);
double scored=10*input.nextDouble();
System.out.println("Enter the target to be achieved");
int target=input.nextInt();//int is enough because run will be always in integer

double remaining=target-scored;
System.out.println("Required Runrate is: "+Math.round(remaining/40*1e2)/1e2);
}
}

Posted On : 2016-06-13 22:55:41
Satisfied : 1 Yes  2 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523185418912
Reply This Thread
up-rate
5
down-rate

class Runrate{
public static void main(String []args){
double cur_runrate=3.2 ;
int target=282;
int cur_over=10;
double cur_run=cur_over * cur_runrate;
int remian_over=40;
double remain_run=target-cur_run;
double req_runrate;
req_runrate=remain_run/remian_over;
System.out.print(req_runrate);
}
}

Posted On : 2017-11-27 17:33:21
Satisfied : 2 Yes  0 No
profile Divesh - anyforum.in Divesh
8800
Reply This Thread
up-rate
0
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in