EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Grocery store discount system scenario

A Grocery store provides discount based on the total bill amount

 

Above Rs.1000: 20% discount

 

Rs.500 to Rs.1000: 10% discount

 

Below Rs.500: No discount

 

Write a java program that calculates the final bill amount after applying the discount

 

import java.util.*;

 

class ASC

{

public static void main(String args[])

{

Scanner s=new Scanner(System.in);

 

System.out.println(“Enter total bill amount:Rs.”);

 

double bill=s.nextDouble();

double discount=0;

 

if(bill>1000)

{

discount= bill*0.20;

}

else if(bill>=500 && bill<=1000)

{

discount=bill*0.10;

}

else

{

discount=0;//no discount

}

 

double finalbill=bill-discount;

 

System.out.println(“Discount=” +discount);

  • System.out.println(“Final bill is here=” +finalbill);

 

}

}

Java practice questions

Leave a Reply

Your email address will not be published. Required fields are marked *

EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Popular Courses

[Course Image]

Introduction to Programming

Learn the fundamentals of programming with Python in this beginner-friendly course.

12 Hours Beginner
[Course Image]

Data Science Essentials

Master the basics of data analysis, visualization, and machine learning.

20 Hours Intermediate
[Course Image]

Web Development Bootcamp

Build modern websites with HTML, CSS, JavaScript and popular frameworks.

30 Hours Beginner
[Course Image]

Digital Marketing Fundamentals

Learn SEO, social media marketing, email campaigns and analytics.

15 Hours Beginner
Educational Website Footer