Contest Entry

Submitted By

kumari98
kumari98

Recently Viewed Contests

  • "Contest Start & End Date "Jan 27, 2021, 12:01 AMApr 26, 2021, 9:00 AM (Asia/Calcutta)
  • "Contest Start & End Date "Jan 27, 2021, 12:01 AMApr 26, 2021, 9:00 AM (Asia/Calcutta)
  • "Contest Start & End Date "Jan 27, 2021, 12:01 AMApr 26, 2021, 9:00 AM (Asia/Calcutta)

Contests You may Like

Real time prices in e-marketing

in Real-time price discovery at e-marketplaces

Description about my Solution:

    we always supporting formers in real time situations by giving good prices to their crop 

formers are our country backbones their crop is our food so we give the good prices for it 

 

according to my code by observation of previous years we give the good prices 

 

by taking average of previous years we do all our code 

 

 

 

 

 

 

 

 

 

 

 

 

import java.util.*;
public class solution {
public static void main(String args[]){

Scanner sc=new Scanner(System.in);
int lastyears=sc.nextInt();

int[] pricesofyear =new int[lastyears];
boolean profit=false;
int sum=0;

for(int i=0;i<lastyears;i++) {

pricesofyear[i]=sc.nextInt();

sum+=pricesofyear[i];
}

double average=sum/lastyears;

System.out.println("Average Price for this year. "+average );

System.out.println("According to last "+lastyears+"years this year price ="+average);
int last=pricesofyear.length-1;

if(average>pricesofyear[last]){
System.out.println("This year formers get profit of"+(average-pricesofyear[last]));
profit=true;
}
else{
System.out.println("This year former lose "+(pricesofyear[last]-average));

}
if(profit){
System.out.println("This year rate is "+average);
}
else{
System.out.print("To provide good rate this year rate for formers is ");
System.out.println(pricesofyear[last]);
}
//
}
}

by kumari98

on 22-02-2021 | "Voting Start & End Date "Apr 12, 2021, 9:00 AMApr 25, 2021, 11:59 PM (Asia/Calcutta)

GitHub Link https://github.com/siva-prasad123/team
0 Votes
0 Likes
0 Comments
146 Views
0 Favourites
0
Media Type: Writing Contest
Category: Cluzters-KO !