Computer Science, asked by jiya6666, 1 year ago

plzz do program no. 18 in java

Attachments:

jiya6666: how much u did?
jiya6666: okay
jiya6666: no wait i got it
jiya6666: i will do it
jiya6666: no yar

Answers

Answered by RohitSaketi
8
package jiyaa;

public class Discount {

public String name;
public String category;
public int days;

public void print_Bill()
{ float money = 0;
String cate=" ";
if(this.category=="S")
{
money=2500;
cate="Semi-Delux";
}
if(this.category=="D")
{
money=3500;
cate="Delux";
}
if(this.category=="SD")
{
money=5000;
cate="Super-Delux";
}
if(this.days<=3)
{
money=(money*90)/100;
}
if(this.days>3 && this.days<=5)
{
money=(money*85)/100;
}
if(this.days>5 && this.days<=10)
{
money=(money*80)/100;
}
if(this.days>10)
{
money=(money*70)/100;
}

System.out.println(this.name +" you hav to pay rs "+money+" for categoery "+cate+" for staying "+this.days+" days.");
}

public static void main(String[] args) {
Discount ob1=new Discount("bk","S" , 10);
Discount ob2=new Discount("bk1","SD" , 5);
Discount ob3=new Discount("bk2","D" , 2);
ob1.print_Bill();
ob2.print_Bill();
ob3.print_Bill();
}

public Discount(String name, String category, int days) {
super();
this.name = name;
this.category = category;
this.days = days;
}
}

jiya6666: i don't know??
RohitSaketi: ok jusT now i checked it... after typing your question..u ll press "ask question" . then it will divert you to new page asking for subject etc..right... on the top u can find a drop down box there u can give upto 100 points
jiya6666: ok
RohitSaketi: bro i just gave example that u can give upto hundred points
jiya6666: ok next time i will increase the points of my question
RohitSaketi: not for my sake ..i just want to help u get quick answers..i ll answer but some times it may take time
jiya6666: okay..
RohitSaketi: @Rumi we shouldnot chat here bro..theyll report us..bye for now!
Similar questions