scanner program

scanner program

a news paper boy purchase 100 papers every day.he purchases papers at Rs.1.50 and sells at Rs.2.00 at each.any unsold news papers,as scrap at a price of Rs.0.50. write a program to read the demand and evaluate his profit..using scanner

View Answers

February 2, 2011 at 3:54 PM

Hi Friend,

Try this:

import java.util.*;
class ScannerExample1
{
    public static void main(String[] args) 
    {  
        Scanner input=new Scanner(System.in);
        System.out.print("Enter demand: ");
        int demand=input.nextInt();
        double cp=100*1.50;
        double left=100-demand;
        double e1=demand*2.00;
        double e2=left*0.50;
        double sp=e1+e2;
        double profit=sp-cp;
        System.out.println(profit);
    }
}

Thanks









Related Tutorials/Questions & Answers:
scanner program
scanner program  a news paper boy purchase 100 papers every day.he...,as scrap at a price of Rs.0.50. write a program to read the demand and evaluate his profit..using scanner
Scanner
Scanner   Hi, I am facing a problem in the following code as what should be the while condition I should use in order to get the loop keep running...= "Celsius"; do { Scanner temp_ip= new Scanner(System.in
Advertisements
Scanner class
Scanner class  import java.util.*; class Dd { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int... wrong init. my program does not work it shows ""cannot resolve symbol"". 
Scanner class
Scanner class  what have to do when an error occur about Scanner class.i code scanner sc=new Scanner(System.in); but it shows an error regarding this.   Use Scanner sc=new Scanner(System.in
ModuleNotFoundError: No module named 'scanner'
ModuleNotFoundError: No module named 'scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'scanner' How to remove the ModuleNotFoundError: No module named 'scanner
ModuleNotFoundError: No module named 'scanner'
ModuleNotFoundError: No module named 'scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'scanner' How to remove the ModuleNotFoundError: No module named 'scanner
without scanner
and class and didn't use the scanner .   Hi Friend,ADS_TO_REPLACE_1 Whether the program will read the data through console or not? Please clarify
Read user input in Java using Scanner
Example of of reading user input in Java using Scanner In this section we are explaining the use of Scanner class in Java which can be used to read user input from console. Our sample program asks user to enter name and then age, user
Scanner
scanner problem - Java Beginners
scanner problem  the program that enters sides of the triangle using scanner and outputs the area of triangle  Hi Friend, We... main(String []args){ Scanner scanner = new Scanner(System.in
cannot find symbol Scanner sc = new Scanner(system.in)
cannot find symbol Scanner sc = new Scanner(system.in)  In my one of the program in getting the error: cannot find symbol Scanner sc = new Scanner(system.in) How to resolve the error: cannot find symbol Scanner sc = new Scanner
How to Read file line by line in Java program
? that includes a text. Now first thing a program has to do is to find the file... in Java using Scanner Class: Besides the Buffer reader, using Scanner class... by line.ADS_TO_REPLACE_6 The benefit of using Scanner class is that it has more
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'collection-scanner' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'collection-scanner' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'collection-scanner' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'gram-scanner'
ModuleNotFoundError: No module named 'gram-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'gram-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'jshint-scanner'
ModuleNotFoundError: No module named 'jshint-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'jshint-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'netbox-scanner'
ModuleNotFoundError: No module named 'netbox-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'netbox-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'port-scanner'
ModuleNotFoundError: No module named 'port-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'port-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'raccoon-scanner'
ModuleNotFoundError: No module named 'raccoon-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'raccoon-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'robots-scanner'
ModuleNotFoundError: No module named 'robots-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'robots-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'rtlsdr_scanner'
ModuleNotFoundError: No module named 'rtlsdr_scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'rtlsdr_scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'ssh_scanner'
ModuleNotFoundError: No module named 'ssh_scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'ssh_scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'ssid-scanner'
ModuleNotFoundError: No module named 'ssid-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'ssid-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'ssl-scanner'
ModuleNotFoundError: No module named 'ssl-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'ssl-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'string-scanner'
ModuleNotFoundError: No module named 'string-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'string-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'tarfile_scanner'
ModuleNotFoundError: No module named 'tarfile_scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tarfile_scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'tarfile_scanner'
ModuleNotFoundError: No module named 'tarfile_scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tarfile_scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'virtual-scanner'
ModuleNotFoundError: No module named 'virtual-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'virtual-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'waveplot-scanner'
ModuleNotFoundError: No module named 'waveplot-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'waveplot-scanner' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'yara-scanner'
ModuleNotFoundError: No module named 'yara-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'yara-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'zebra-scanner'
ModuleNotFoundError: No module named 'zebra-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'zebra-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'barcode-scanner'
ModuleNotFoundError: No module named 'barcode-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'barcode-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'cloud-scanner'
ModuleNotFoundError: No module named 'cloud-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cloud-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'collection-scanner'
ModuleNotFoundError: No module named 'collection-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'collection-scanner' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'gram-scanner'
ModuleNotFoundError: No module named 'gram-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'gram-scanner' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'jshint-scanner'
ModuleNotFoundError: No module named 'jshint-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'jshint-scanner' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'kafka-scanner'
ModuleNotFoundError: No module named 'kafka-scanner'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'kafka-scanner' How to remove the ModuleNotFoundError: No module named
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
scanner Class Error - Java Beginners
scanner Class Error  Hello Sir ,When i run the program of Scanner Class ,there is Error Can not Resolve Symbol-Scanner how i can solve..., Scanner class is not provided. Check your version.It should work with java 1.5
program
program  any program of hotel or school management
program
program  program of jdbc using ms access for creating table
program
program  write a javascript program to create a application form with validation
program
program  write a html program in show table and this word in box
program
program  write a program different between to dates in terms of days in java
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program   An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit that consumes

Ads