Skip to main content

Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 10% is offered if the expense is more than 7000.

 

#include<iostream.h>
#include<conio.h>
void main()
{
	int totalexp, qty, price, discount;
	cout<<"Enter quantity:";
	cin>>qty;
	cout<<"Enter price:";
	cin>>price;
	totalexp=qty*price;
	if(totalexp>7000)
	{
		discount=(totalexp*0.1);
		totalexp=totalexp-discount;
	}
	cout<<"Total Expense is  Rs. "<<totalexp;
	getch();
}
 

Comments

  1. can u convert this program in java

    ReplyDelete
  2. public class Expenses
    {
    public static void main(String args[])
    {
    int qty,price;
    double discount,totalexp;
    qty=Integer.parseInt(args[0]);
    price=Integer.parseInt(args[1]);
    totalexp=qty*price;
    if(totalexp>7000)
    {
    discount=(totalexp*0.1);
    totalexp=totalexp-discount;
    }
    System.out.println("Total Expense is Rs. "+totalexp);
    }
    }

    ReplyDelete
    Replies
    1. can u convert this program when 1 or more items are there

      Delete
  3. You can Compile and Run this program

    javac Expenses.java
    Java Expenses 5 200
    Total Expense is Rs. 1000.0

    ReplyDelete
  4. Can you please re-write this program using dialog box (j pane) GUI based

    ReplyDelete
  5. can u write this program in class

    ReplyDelete
  6. write a program to prepare bill of employee and store name , product, quantiny and stock amount. calculate the 10 % discount if stock amount is over 50 in qbasic.i need in qbasic. plz reply fast.

    ReplyDelete
  7. can u convert into a c language

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Can u convert in this program in class in c++

    ReplyDelete
  11. Design a class Market to calculate the total expenses. The quantity and price per item are input by the user and discount of 10% is offered if the expense is more than 5000.

    ReplyDelete
  12. write a program for car rental. select a car type from 3 car types(day rates A$50,B$70 & C$100), fix bond of $200, daily insurance of $20/day and Total cost.

    ReplyDelete

Post a Comment

Popular posts from this blog

WAP to calculate the monthly telephone bills as per the following rule: Minimum Rs. 200 for upto 100 calls. Plus Rs. 0.60 per call for next 50 calls. Plus Rs. 0.50 per call for next 50 calls. Plus Rs. 0.40 per call for any call beyond 200 calls.

  #include<iostream.h> #include<conio.h> void main() { int calls; float bill; cout<<" Enter number of calls : "; cin>>calls; if (calls<=100) bill=200; else if (calls>100 && calls<=150) { calls=calls-100; bill=200+(0.60*calls); } else if (calls>150 && calls<=200) { calls=calls-150; bill=200+(0.60*50)+(0.50*calls); } else { calls=calls-200; bill=200+(0.60*50)+(0.50*50)+(0.40*calls); } cout<<" Your bill is Rs. "<<bill; getch(); }   Output: Enter number of calls : 190 Your bill is Rs.250