Question

NEED FAST Consider a scenario in which a realty company uses a ranking system of values...

NEED FAST

Consider a scenario in which a realty company uses a ranking system of values from 0-6 to determine realtor commission percentage and homeowner net sale proceeds. Create the code for java appllication that prompts the user for the realtor ranking and the home sale price. Use the ranking to determine the commission percentage based on the table below, ten calculate the commission cost and net homeowner proceeds ( sale price - commission) in dollars. The code must run multiple test cases of rankings and home sales prices one execution. Use an array or arrays to store the input values. Assume rankings are only 0 to 6 inclusive. The employee ranking must be greater than or equal to zero and less than 7. If less than zero or greater than 6, reprompt for a valid value. Code should have statements to output the calculated commission and homeowner proceeds for each case.

Ranking Commission %

0 0.5

1 1.25

2 3.0

3 4.5

4 6.25

5 6.75

6 7

7 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;


class Commission
{
int rank;
float sale_price;
  
Commission(int r, float s)
{
this.rank = r;
this.sale_price = s;
}
float calculate()
{
int check = rank;
float final_price;
if(check == 0){
final_price = (float)(sale_price - (sale_price * 0.005));
  
}
else if (check == 1)
{
final_price = (float)(sale_price - (sale_price *0.0125));
}
else if (check == 2)
{
final_price =(float) (sale_price - (sale_price * 0.030));
}
else if (check == 3)
{
final_price =(float) (sale_price - (sale_price * 0.045));
}
else if (check == 4)
{
final_price =(float) (sale_price - (sale_price * 0.0625));
}
else if (check == 5)
{
final_price = (float)(sale_price - (sale_price *0.07));
}
else
{
final_price =(float) (sale_price - (sale_price *0.03));
}
return final_price;
}
   public static void main (String[] args)
   {
   Scanner input = new Scanner(System.in);
  
   int rank[]=new int[1];
   int check = 0 ;
       int flag = 0;
   while(flag == 0)
   {
   System.out.println("please enter your rank");
   check = input.nextInt();
       if((check < 0)&&(check > 7))
           flag = 0;
       else
           flag = 1;
     
   }
   rank[0] = check;
  
   System.out.println("enter the sale price");
   float sale = input.nextFloat();
  
       Commission c = new Commission(check,sale);
       float final_price = c.calculate();
       System.out.println("Fianl price is :" + final_price);
   }
}

Add a comment
Know the answer?
Add Answer to:
NEED FAST Consider a scenario in which a realty company uses a ranking system of values...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A method called linearSearch(), which takes as parameters an array of int followed by three values...

    A method called linearSearch(), which takes as parameters an array of int followed by three values of type int, and returns a value of type int. The first int parameter represents a key, the second int parameter represents a starting position, and the third int parameter represents an end position. If the key occurs in the array between the start position (inclusive) and the end position (exclusive), the method returns the position of the first occurrence of the key in...

  • do it using MATLAB plz and fast plaz full work 1. The residents of Bikini Bottom...

    do it using MATLAB plz and fast plaz full work 1. The residents of Bikini Bottom are ranked on a toughness scale from 0-100. If a resident's toughness number is 45 or less, they have to eat at Super Weenie Hut Junior. If a resident's toughness number is between 45 and 90 (including 90). they have to eat at Weenie Hut Junior. Those with a toughness number greater than 90 can eat at the Salty Spitoon. Write a program which...

  • Please answer the questions correctly ASAP. It's multiple choice. 1) 2) 3) Which of the following...

    Please answer the questions correctly ASAP. It's multiple choice. 1) 2) 3) Which of the following values of the Condition Code (N Z P) could occur in the LC-3 to indicate that the value written to the register file is less than or equal to zero? [You must check all that apply to get credit.] 000 001 011 100 101 110 111 Which of the following instructions overwrite the Condition Code? [You must check all that apply to get credit.]...

  • Ques) Write a program in c, which meets the following requirements. Requirements 1. Read integer values...

    Ques) Write a program in c, which meets the following requirements. Requirements 1. Read integer values from stdin, separated by one or more spaces or newlines, until reaching EOF 2. The input is guaranteed to be well-formed. 3. The input contains no more than 80 values. 4. on standard output, render a simple vertical column graph representation of the input values, in order left to right, using hash'#' characters as shown in the examples below. The number of hashes printed...

  • Your goal is to create an ‘Array’ class that is able to hold multiple integer values....

    Your goal is to create an ‘Array’ class that is able to hold multiple integer values. The ‘Array’ class will be given functionality through the use of various overloaded operators You will be given the main() function for your program and must add code in order to achieve the desired result. Do not change any code in main(). If something is not working, you must change your own code, not the code in main(). Assignment 5: overloading member functions. Overview:...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named...

    This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...

  • java code need this part java code here is test There is one public constructor: public...

    java code need this part java code here is test There is one public constructor: public Backpacker (int initialFunds, City initialCity) Constructs a Backpacker starting out with the given amount of money in the given city. The journal is initially a string consisting of "cityname(start)", where cityname is the name of the starting city. There are the following public methods: public String getCurrentCity ( ) Returns the name of the Backpacker's current city. public int getCurrentMoney () Returns the amount...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT