124k views
1 vote
In a certain company the cost of software depends on the license type which could be Individual or Enterprise. Write a program that reads  License Type wanted (just the first character of each type: I, i, E, e).  Number of Users to use the software. Type Price/User Minimum number of users Individual 500$ 1 Enterprise 300$ 5 Your program should:  Check if the number of users is greater than or equal than Minimum Number of Users allowed Compute the cost: (for example cost = Cost per user x Number of Users)

User Lyaffe
by
4.1k points

1 Answer

1 vote

Solution :

import
$\text{java}.$util.*;

public
$class$ currency{

public static
$\text{void}$ main(String
$[]$ args) {

Scanner input
$=$ new Scanner(System
$\text{.in}$);

System
$\text{.out.}$print("Enter
$\text{number of}$ quarters:");

int quarters = input.nextInt();

System.out.print("Enter number of dimes:");

int
$\text{dimes =}$ input.nextInt();

System
$\text{.out.}$print("Enter number of nickels:");

int nickels = input.nextInt();

System
$\text{.out.}$print("Enter number of pennies:");

int
$\text{pennies = }$ input.nextInt();

// computing dollors

double dollars = (double) ((quarters*0.25)+(dimes*0.10)+(nickels*0.05)+(pennies*0.01));

System
$\text{.out.}$format("You have : $%.2f",dollars);

}

}