4.9k views
3 votes
A cycle merchant allows 15% discount on the marked price of a bicycle and still he makes a profit

of 20%. Write a program to calculate Marked price and Cost price of cycle if the he offers Rs. 600 as

discount to the customer.
in java program
please do it​

User Xtina
by
4.6k points

1 Answer

6 votes

Answer:

The program in Java is as follows:

public class Main{

public static void main(String[] args) {

double discount_percent = 0.15;

double discount_amount = 600;

double profit = 0.20;

double marked_price = discount_amount/discount_percent;

double cost_price = marked_price/(1 + profit);

System.out.println("Marked Price: "+marked_price);

System.out.println("Cost Price: "+cost_price);

}}

Step-by-step explanation:

For explanation purpose, let


MP \to Marked Price


\%D \to Percentage discount


D \to Discounted amount


\%P \to Percentage Profit


C \to Cost Price

The marked price (i.e. selling price) is calculated discount using:


MP = (D)/(\%D)

The derived formula of the cost price from percentage profit and Marked Price is:


C = (M)/(1 + \%P * 100)

So, the explanation is as follows:

The next three lines declare and initialize the given parameters

double discount_percent = 0.15;

double discount_amount = 600;

double profit = 0.20;

Calculate marked price

double marked_price = discount_amount/discount_percent;

Calculate cost price

double cost_price = marked_price/(1 + profit);

Print marked price

System.out.println("Marked Price: "+marked_price);

Print Cost price

System.out.println("Cost Price: "+cost_price);

User Junming
by
4.4k points