Sunny89 0 Newbie Poster

Rather than read in the sales data we will generate it randomly using the Math.random() function. Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit. Thus Random(5.5, 19.6) would generate random numbers x such that 5.5 <= x < 19.6. Note that our Random will also exclude the upper limit as a possible value.

Write a Java program that will read in a file of commission information, and a file of sales staff names. The program will print out the name of each sales person followed by their quarterly sales, total sales for the year, and their commission bonus in a nicely formatted report. The report shows the sum of the quarterly calculated commission amounts. The commission file simply contains a few numbers that define how to calculate commissions. The commission amount is calculated for each quarter. The commission file contains 3 lines. The first line contains the level of sales used for the first commission rate that follows. Sales up to this amount generate a commission using the first rate. The second line contains the second level and rate. If the sales for the quarter are between the first and second level then the sales generate a commission using the second rate. The third line contains the third rate. If the sales for the quarter exceed the second level then commission is generated at the third rate. Here is a typical commission file:

50000 5.55 <- if quarterly sales <= 50000 use 5.55% as the rate
70000 6.85 <- if quarterly sales > 50000 and <= 70000 use 6.85%
8.15 <- if quarterly sales > 70000 use 8.15%

The sales staff file will only contain names. The quarterly sales figures for each sales person will be generated by your Random function that returns doubles. When generating random sales figures use 10000.0 and 25000.0 as the parameters. The file of sales staff names will be read until end of file is reached.

In addition to the Random function include a subroutine to read in the commission file data and a function to calculate the commission for each quarter. You may include other subroutines or functions if you wish.

this is my solutin can someone guide me further and write for me pseudo code plz..

public class money{
  
  static double random(double a, double b){
    double sales;
    
    sales=10000.0*Math.random()+15000.00;    
    return sales;
  }

  public void readcommfile("commission.txt"){
    
double sale,rate;
for (int i=1;i<=3;i++){
  
sale=TextIO.getlnDouble();
rate=TextIO.getlnDouble();
return sale;
return rate;
}

  
public static void main (String[] args){
  
  double  amount;
  double total=0,com;
  
  
  for (int i=1;i<=4;i++){
  
  amount=random(10000.0,25000.0);
  TextIO.putf("%1.2f",amount);
  total+=amount;
  
  TextIO.put("\t");
}
  TextIO.putf("%1.2f",total);
}
}