Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Quick Java program

BunkerHillBroad
BunkerHillBroad 


file Charity.java A certain charity designates donors who give $10,000.00 or more as Benefactors; those who give $1,000.00 to $9,999.99 as Patrons; those who give $500.00 to $999.99 as Supporters; those who give $100.00 to $499.99 as Friends; and those who give less than $100 as Cheapskates. Write a static method named donor containing a nested if-else statement (or statements) that accepts a single double parameter that contains the amount of a contribution. This method outputs the correct designation for that contributor. You will write a main program that asks the user to enter the amount of a contribution, and then passes this value on to the donor method (which then prints the correct result). Here’s an example to illustrate your program in action: Enter the amount of a contribution: $35.77 Cheapskate! Test your program also for the input values: 21000.0, 2200.00, 10000.00, 1000.00, 500.00, 999.99, 15.00, 499.99, 100.00, 99.99, 75.33, -17.30, and 600.22 An appropriate error message should be output (and your program should halt) when an amount less than 0 is input. Attachments
Tags Clarifications

Answers

Solution

mariobeka
mariobeka 



The program is implemented as specified in the question. Attachments
Charity.java (1 K) Download Preview
100) { return "Friends!"; } else if (amount < 100) { return "Cheapskates!"; } return ""; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the amount

Screenshots
Purchase Answer