Question

Intro to java 10th edition: Write a java program in Eclipse about two oil companies are...

Intro to java 10th edition:

Write a java program in Eclipse about two oil companies

are up for a special pay decrease and increase profit.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//This is a basic Java Program which ask the user for the cost price of the product and calculates the discounted price which will give profit as well.

import java.util.Scanner;

public class SellingPrice {

      public static void main(String[] args) {

            // TODO Auto-generated method stub

            //Scanner function to get the input from keyboard

            Scanner scan = new Scanner(System.in);

            System.out.print("Enter the cost price of the item: ");

            //Ask the user to enter Cost Price of item

            double costPrice = scan.nextDouble();

            // Since the Marked price is increased by 80% of the cost Price

            // Cost Price is multiplied by 180%

            double markedPrice = costPrice * 1.8;

            System.out.println("Marked Price: "+ markedPrice);

            // Discount of 10% is calculated on the marked price

            double discount = markedPrice * 0.1;

            System.out.println("Discount: "+ discount);

            // Selling Price of the item is marked price - discount

            double sellingPrice = markedPrice- discount;

            System.out.println("Selling Price: "+ sellingPrice);

      }

}

Add a comment
Know the answer?
Add Answer to:
Intro to java 10th edition: Write a java program in Eclipse about two oil companies are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • use eclipse to do Using String -- continued Intro To Java (Lab) Northwestern Polytechnic University Dr....

    use eclipse to do Using String -- continued Intro To Java (Lab) Northwestern Polytechnic University Dr. Nels Vander Zanden 4 • After program on previous slide is working, add support to handle the following cases: o No ‘*’ character is found (print a message indicating this) o Only one ‘*’ character is found (print a message to indicate this) Compare two Strings  Write a program to see if two Strings are the same e.g. String startMonth = "June"; String...

  • Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array...

    Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array of 100 integers. Initialize the array to have all zeros. 2. Puts even numbers starting from 6 (excluding multiples of 12) into the first 50 slots of the array above. So numbers 6,8,10,14,16,18,20,22,26, etc. go into the first 50 positions in the array. Print the array. 3. Puts random numbers between 45 and 55 into the second 50 slots of the array above (second...

  • Class: Java Book: Introduction To Java Programming 10th Edition, Comprehensive by Daniel Liang Problem: ****** Parse...

    Class: Java Book: Introduction To Java Programming 10th Edition, Comprehensive by Daniel Liang Problem: ****** Parse the text file by splitting on "[ \n\t\r.,;:!?(){}<>\"]", that is call the split method with this parameter: For example, call contents.split("[ \n\t\r.,;:!?(){}<>\"]"), where contents is a String object containing the contents of the text file. Also, explain (in the comment block at the beginning of the source file) two other approaches that could have been taken for the problem (use of other data structures,...

  • Java Eclipse program Write statements to declare and initialize eight constants, one for each of the...

    Java Eclipse program Write statements to declare and initialize eight constants, one for each of the primitive types in Java. boolean, byte, char, short, int, long, float and double. Add statements to print the name of the constant and its value to your VariableDefinitions.javaprogram and compile the program. Assign a new value to one of the constants and compile. Comment out the lines of code that cause compilation errors but do not delete them and recompile your program.

  • Hi. Intro Java hw help needed; Update an existing Java program that inputs two integers and...

    Hi. Intro Java hw help needed; Update an existing Java program that inputs two integers and outputs their sum, quotient and remainder by adding code to also output the difference and product.

  • We should use “Java” language. Java Eclipse :) Fall 2019 1. Assign each line to a...

    We should use “Java” language. Java Eclipse :) Fall 2019 1. Assign each line to a variable and write the passage from Shakespeare's Sonnet #52 to console (Careful about line breaking): Blessed are you whose worthiness gives scope, Being had, to triumph; being lacked, to hope. 2. Create two integer variable, width and height. Write them to console in similar format, i.e. Width of rectangle is 5. 3. Update width and height variable with another value, and write them to...

  • Write a Java program that determines if a person hits the "Pick 3" loterry numbers. Have...

    Write a Java program that determines if a person hits the "Pick 3" loterry numbers. Have the program to randomly create a 3 digit lottery number. Have the user enter the number they will be playing and the results: (DO NOT USE ARRAYS or STRINGS) -If the user input matches the lottery number in the exact order, the award is $5Million. -If all the digits in the user input match all the digits in the lottery number, the award is...

  • need help!! java eclipse Write a program to implement bubble sort, insertion sort, selection sort, merge...

    need help!! java eclipse Write a program to implement bubble sort, insertion sort, selection sort, merge sort and quick sort (pivot - first index) algorithms. a) Compute the CPU processing time for all the algorithms for varying input sizes as follows: N-10, 103, 10, 10, and 106 b) Use a random number generator to generate the inputs. Obtain the inputs from the following input ranges: 1- 10, 1 -10, 1 - 10, 1 12 10 c) Write down your results...

  • need help, please!!!!! (netbeans) by JAVA Q: write a hole program started from the package In...

    need help, please!!!!! (netbeans) by JAVA Q: write a hole program started from the package In chess, the knight moves in a very special way: either: two squares forward and one to the side or : one square forward and two to the side Write a program to print the Probability of the moves and the main for the program

  • u are to write a program in Java that takes two sets of up to 5...

    u are to write a program in Java that takes two sets of up to 5 symbols(letters, numbers or any characters) and prints the cartesian product of the two sets. The program should allow the user to enter the characters for each set and the output should, consist of the name of each set followed by the characters and on the following line print the cartesian product. Example: {1,3,*} X {3,?,D} = {(1,3),(1,?),(1,D),(3,3),(3,?),(3,D,(*,3),(*,?),(*,D)} or {2,3,5,7} X (5,6} = {(2,5),(2,6),(3,5),(3,6),(5,5),(5,6),(7,5),(7,6)}

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT