Question

You want to rate a mobile phone, according to the following conditions: (0) Price should be less than 1500 AED. Screen size s

Code in java

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;
public class Main
{
        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                System.out.print("Enter the price of the phone:");
                int p=sc.nextInt();
                System.out.print("Enter the screen size:");
                float size=sc.nextFloat();
                System.out.print("Enter the weight of phone in grams:");
                int weight=sc.nextInt();
                if(p<1500 && size>=4 && weight<200)
                {
                    System.out.println("The rate is 5 stars");
                }
                if(p<1500 && size>=4 && weight>=200)
                {
                    System.out.println("The rate is 4 stars");
                }
                if(p>=1500 && size>=4 && weight<200)
                {
                    System.out.println("The rate is 3 stars");
                }
                if(p<1500 && size<4 && weight<200)
                {
                    System.out.println("The rate is 2 stars");
                }
                        if(p>1500 && size<4 && weight>=200)
                {
                    System.out.println("The rate is 0 stars");
                }
        }
}

Enter the price of the phone:1600 Enter the screen size:5.5 Enter the weight of phone in grams: 160 The rate is 3 stars

Add a comment
Know the answer?
Add Answer to:
Code in java You want to rate a mobile phone, according to the following conditions: (0)...
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
  • Grade of Steel (10 Points) (JAVA) A certain grade of steel is graded according to the...

    Grade of Steel (10 Points) (JAVA) A certain grade of steel is graded according to the following conditions: a) Hardness (integer) must be greater than 50 b) Carbon content (float) must be less than 0.7 c) Tensile strength (integer) must be greater than 5600 The grades are as follows: • Grade is 10 if all three conditions are met • Grade is 9 if conditions a) and b) are met • Grade is 8 if conditions b) and c) are...

  • Dr. Gebhardt just upgraded her phone to an iPhone Xs (she previously had an iPhone 6)...

    Dr. Gebhardt just upgraded her phone to an iPhone Xs (she previously had an iPhone 6) and paid $1149 for the phone. She didn't know if she should purchase insurance for her phone. You need to help her Dr. Gebhardt has created a table similar to Table 5.2 or 5.3 in your text based on the following probabilities of damage or loss when she does not have insurance (see Probability Table 1) There is a 30% likelihood that Dr. Gebhardt...

  • Write a program in java. You are tasked with writing an application that will keep track...

    Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...

  • create a new Java application called "WeightedAvgWithExceptions" (without the quotation marks), according to the following guidelines...

    create a new Java application called "WeightedAvgWithExceptions" (without the quotation marks), according to the following guidelines and using try-catch-finally blocks in your methods that read from a file and write to a file, as in the examples in the lesson notes for reading and writing text files. Input File The input file - which you need to create and prompt the user for the name of - should be called 'data.txt', and it should be created according to the instructions...

  • JAVA, please You must write a robust program meaning that your program should not crash with...

    JAVA, please You must write a robust program meaning that your program should not crash with any given data. Data validation must be done any time that user enters an input. Write a program that 1. Gets an infix expression form the user and evaluate the expression using stack ADT a. Finds the postfix equivalent of the given infix expression b. Evaluate the created postfix expression. c. Note: your program should not crash when you enter an invalid expression such...

  • Write the following program in Java using Eclipse. A cash register is used in retail stores...

    Write the following program in Java using Eclipse. A cash register is used in retail stores to help clerks enter a number of items and calculate their subtotal and total. It usually prints a receipt with all the items in some format. Design a Receipt class and Item class. In general, one receipt can contain multiple items. Here is what you should have in the Receipt class: numberOfItems: this variable will keep track of the number of items added to...

  • MULTIPLE CHOICE 1) Which of the following is NOT an investment as defined in the text?...

    MULTIPLE CHOICE 1) Which of the following is NOT an investment as defined in the text? A) a certificate of deposit issued by a bank B) a new automobile C) a United States Saving Bond D) a mutual fund held in a retirement account 2) Which of the following is NOT traded in the securities markets? A) stocks B) bonds C) derivatives D) real estate 3) The governmental agency that oversees the capital markets is the A) Federal Trade Commission....

  • Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders...

    Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders that come in. This program will require multiple classes. Summary class, customer class, order class and the driver class. Summary class This class will keep track of the cost of the order and output a summary, which includes the total for the order. The methods in this class are static. There are no instance variables, and instead uses an Order object that is passed...

  • code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation...

    code in java please:) Part I Various public transporation can be described as follows: A PublicTransportation class with the following: ticket price (double type) and mumber of stops (int type). A CityBus is a PublicTransportation that in addition has the following: an route number (long type), an begin operation year (int type), a line name (String type), and driver(smame (String type) -A Tram is a CityBus that in addition has the following: maximum speed (int type), which indicates the maximum...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

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