Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners scanner program

Have Programming Question? Ask it here!
 
 
 


harika chinni
scanner program
1 Answer(s)      3 years and 5 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


Advertisement
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
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(System.in
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
XII STD RECURSION WITHOUT SCANNER
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 java.io.*; 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
program  any program of hotel or school management
program
program  write a program different between to dates in terms of days in java
program
program  write a html program in show table and this word in box
program
program  write a javascript program to create a application form with validation
program
program  program of jdbc using ms access for creating table
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
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   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
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link: Java Threads Thanks
Program
Program  a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
Program
Program  a program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = ‚??Tommy‚?? age=‚??23‚?? and call this constructor
program
program  how to improve programming skills plss tell some tips..i am understanding concepts but unable to write program so,pls give some guideness plsss
program
program  Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean
program
program  no i want a program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of program is to show algorithm
program
program  i want a progra in java to print a sentence in alphabetic order, taking the input from the user.the program should writen without using the array for example : if input= this is a cat then output sould = a cat
program
program  Write a JSP Program, which displays a web page containing the name of the Courses, Courses being offered currently, number of students enrolled in each course, new courses to be offered, eligibility criteria for taking
program
program  . Develop a program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional
program
program  Write a program to print details of a week for a particular day using array of objects Integer and String. OUTPUT: First Day of Week is Monday Second Day of Week is Tuesday Third Day of Week is Wednesday Forth Day
program
program  Write a JSP Program, which displays a web page containing two web links one for your profiling and other for the schedule of theory of practical classes of your Batch. When one click on link for getting your profile
program
program  Utopias tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the program calculateTax which determines the tax on the gross pay. Define
constructor program
constructor program  write a program to calculate the gross salary... address,basic,hra,da,ta,vehicle loan,personel loan use the scanner class....using constructor.pls send program
Fibonacci program
fibonacci numbers they would like the program to print. I need to use a main...) { Scanner s = new Scanner( System.in); System.out.println("How many...; //Scanner first = new Scanner( System.in); //System.out.println("Please
JAva program
JAva program  Write a JAva program that takes various string from command line and display them in sorted order.   Java display strings...(String[] args) { Scanner input=new Scanner(System.in
Java program
Java program  Write a Java program that takes 3 integer numbers from...*; class Greatest { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter Number1
Summary - Scanner
Java: Summary - Scanner The main use of java.util.Scanner is to read values from System.in or a file. Many Scanner methods fit a simple pattern: nextXYZ..., but Scanner also supports BigDecimal, BigInteger, Float (returns float), Boolean (returns
Java program
Java program  Write a Java program that tales filename or directo;ry name from command line. If it is a vlid flename then it should display its...) { Scanner input=new Scanner(System.in); System.out.print("Enter file
Advertisements
 

 

 

DMCA.com