ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 11 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 29 Apr 2017 My Price 8.00

Java is the second of four languages

INTRODUCTION: Java is the second of four languages you will be learning. Java is an object-oriented programming language used widely in business and industry.   

Part 2 :

1. Modify the program to read user input for carYears

2. Write multiple if statements.

If carYear is 1969 or earlier, print "Probably has few safety features."

If 1970 or higher, print "Probably has seat belts."

If 1990 or higher, print "Probably has anti-lock brakes."

If 2000 or higher, print "Probably has air bags."

3. End each “phrase” with period and move the cursor to a newline.

 

Ex: carYear = 1995 prints:

Probably has seat belts.

Probably has anti-lock brakes.

import java.util.Scanner;

public class CarFeatures {

   public static void main (String [] args) {

      int carYear = 0;

      carYear = 1940;

      /* Your solution goes here  */

      return;

   }

}

 

Part 3 :

  1. 1. Run the program and observe the salary earned.
  2. 2. Modify the program to read user input for weeklyHours. Run the program again.

import java.util.Scanner;

public class Salary {                        

  public static void main(String [] args) {

      Scanner scnr = new Scanner(System.in);

      int hourlyWage = 0;

      int weeklyHours = 0;

      int weeklySalary = 0;

      int overtimeHours = 0;

      final int WEEKLY_LIMIT = 40;

      System.out.println("Enter hourly wage: ");

      hourlyWage = scnr.nextInt();

      // FIXME: Get user input value for weeklyHours

      weeklyHours = 40;

      if (weeklyHours <= WEEKLY_LIMIT) {

         weeklySalary = weeklyHours * hourlyWage;

      }

      else {

         overtimeHours = weeklyHours - WEEKLY_LIMIT;

         weeklySalary = (int)((hourlyWage * WEEKLY_LIMIT) +

                              (hourlyWage * overtimeHours * 1.5));

      }

      System.out.print("Weekly salary is: " + weeklySalary);        

     return;

  }

Answers

(11)
Status NEW Posted 29 Apr 2017 04:04 AM My Price 8.00

-----------

Attachments

file 1493441850-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)