Page 1 of 1

10141 - Request for Proposal

Posted: Sun Dec 04, 2016 7:59 pm
by hasib824
Hello Everyone following is my Java code . Can you please tell me why I am getting Runtime error ?? I have tried several times . Thanks in advance
------------------------------------------------------------------------------------------------------------------------------------------

import java.util.*;
public class Main{

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
float n = 1;
int it = 1;
float p;
float compliance = -1.0F;
String selected = "";
float cprice = 0.0F;
while (n != 0) {
n = sc.nextInt();
p = sc.nextInt();
while (n != 0) {
sc.nextLine();

for (int i = 0; i < n; i++) {
sc.nextLine();
}
for (int i = 0; i < p; i++) {
String RFP = sc.nextLine();

float price = sc.nextFloat();
float requirement_met = sc.nextFloat();
float comp = requirement_met / n;
if (comp > compliance) {
compliance = comp;
selected = RFP;
cprice = price;
} else if (compliance == comp) {
if (price < cprice) {
compliance = comp;
selected = RFP;
cprice = price;
}
}
sc.nextLine();
for (int j = 0; j < requirement_met; j++) {
sc.nextLine();
}
}
System.out.println("RFP #" + (it++) + "\n" + selected + "\n");
}
}
}
}