Question: scanner program



Share on Google+Share on Google+

harika chinni
scanner program
1 Answer(s)      6 years and 3 months ago
Posted in : Java Beginners

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.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;



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   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(
Scanner class
Scanner class  import java.util.*; class Dd { public static void main(String args[]) { Scanner sc=new Scanner(; 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(; but it shows an error regarding this.   Use Scanner sc=new Scanner(
without scanner
and class and didn't use the scanner .   Hi Friend, Whether the program will read the data through console or not? Please clarify this! Thanks
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(
cannot find symbol Scanner sc = new Scanner(
cannot find symbol Scanner sc = new Scanner(  In my one of the program in getting the error: cannot find symbol Scanner sc = new Scanner( How to resolve the error: cannot find symbol Scanner sc = new Scanner
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
Hp scanner - Java Beginners
Hp scanner  Hi guys, i would like to access hp scanner using java programme. could you refer me some useful information to proceed
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
Scanner vs. BufferedReader
Scanner vs. BufferedReader  I have to decide from these two classes to read a file. File is of .txt type and its size is around 4.5 GB. There other text files also which is around 7 to 10 GB. So, which class is to be used to read
for two input numbers. the code of my program is as follows and the error comes... not wish to use the scanner class Is there anything i can do to improve
Java file scanner
Java file scanner In this section, you will learn how to read a file using Scanner class. Description of code: J2SE5.0 provides some additional classes.... It also parses the primitive data. Scanner class gives a great deal of power
How to Read file line by line in Java program
. Now first thing a program has to do is to find the file. For this we use... in Java using Scanner Class: Besides the Buffer reader, using Scanner class.... The benefit of using Scanner class is that it has more utilities like nextInt
barcode scanner device usage in database application
barcode scanner device usage in database application  Am trying to design a supermarket inventory desktop database application however I can't seem to know how to use a barcode scanner device on my application can anyone put me
with out using scanner mul two matrices
with out using scanner mul two matrices  write a java program to multiply two matrices and print there result. note: don't use the scanner and the values is passed at run time....   import*; class
Pattern,Matcher,Formatter and Scanner classes
Pattern,Matcher,Formatter and Scanner classes This section Describes : 1... using the Formatter and Scanner classes and the PrintWriter.format/printf..., n) Formatted input The scanner API provides basic input
input using scanner and add/sub/mul/div of a matrix
input using scanner and add/sub/mul/div of a matrix  hiiii...... performe matrix add/sub/mul/div using scanner
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using constructor ????  im getting error here..i hav used scanner class... am i getting error here... can we get output using scanner class , object
Local Port Scanner
Local Port Scanner       This is a simple program of java network. Here, we are going to define.... Socket classes are used to establish a connection between client program
program  any program of hotel or school management
program  write a program different between to dates in terms of days in java
program  write a html program in show table and this word in box
program  write a javascript program to create a application form with validation
program  program of jdbc using ms access for creating table
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
Java Spring Hibernate Struts Training Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include?


Advertisement null