Write program that reads integerthat is your cwidand breaks

Assignment Help Computer Engineering
Reference no: EM133516226

Homework

Read the following instructions before working on the homework:

I. Homework will be given and returned via the D2L as a convenience to the students and the instructor. Do not send homeworks via email.

II. It is the student's responsibility to have all homeworks ready on time by the given due date. Late homework may not be accepted.

III. Discussion is allowed and encouraged, but no cheating. Homework with copied answers or other cheating (all or in part) receive a grade of 0.

IV. Homeworks or programs with extra features, and fancy output, you may receive extra scores.

V. The first lines of the source code of the program should include a comment with the following information and format:

/**
* A short description of the program.
*
* @author's last name, first Name
* @homework CSCI 428 Homework X -Qn M
* @date MM/DD/ YYYY
*/

VI. For all programming questions (e.g., Qns 3-4), copy the Java source code into the word file named "CSCI428-AssignX-XX.doc(x)"and screenshots of the program's output. Please replace the first `X' with the Homework number and "XX" with your first name and last name. For instance, the title for homework 01 should be "CSCI428- Assign01-JessicaRuby.doc(x)".

VII. List answers to all short-answer questions.

Task

I. Write declarations for storing the following quantities. Choose between integers and floating-point numbers. Declare constants when appropriate.

1. The number of days per week

2. The number of days until the end of the semester

3. The number of centimeters in an inch

4. The height of the tallest person that you think in your class, in centimeters.

5. The price of a single can of Coca-Cola

6. Fringe benefit rate for student workers (Fringe benefit rate for student workers is 3%)

7. Your current age

8. The number of students in CSCI 428

9. The minimum hourly rate for student workers that you may know or guess.

10. The length of a football field

II. Write Java statements that accomplish the following.

1. Declare int variables x and y.

2. Declare Stringvariables firstName and lastName.

3. Initialize an int variable x to the last two digits of your CWID.

4. Declare and initialize a char variable ch to the first letter of your first name.

5. Initialize the String variables to your first name and last name.

6. Update the value of an int variable x by adding 5 to it.

7. Declare and initialize a double variable payRate to 12.50.

8. Copy the value of an int variable firstNum into an int variabletempNum.

9. Swap the contents of the int variables x and y. (Declare additionalvariables, if necessary.)

10. Declare and initialize a String variable fullName by using the variables firstName and lastName.

11. Output the values of x, y, andthe expression x + 12 / y - 18.

12. Declare a char variable grade and set the value of the grade to 'A'.

13. Declare int variables to store four integers.

14. Copy the value of a double variable z to the nearest integer intoan int variable x.

15. Update the variable ch to represent the last digit of your CWID and print out its ASCII value. (The ASCII table can be found on P40 of the file "01-csci428_lecture_Introduction of Java")

III. Write a program that prompts the user for two integers and then prints

1. The sum

2. The difference

3. The product

4. The average

5. The distance (absolute value of the difference)

6. The maximum (the larger of the two)

7. The minimum (the smaller of the two)

8. Suppose the two integers are the lengths of a rectangle's sides. Print the area and perimeter of the rectangle andthe length of the diagonal (use the Pythagorean theorem)

Hint: The max and min functions are declared in the Math class.

IV. Write a program that reads an integerthat is your CWIDand breaks it into a sequence of individualdigits. For example, your CWID is12345678 and can be displayed as

1 2 3 4 5 6 7 8

Calculate and print the total and average of the digits. Here is a sample run; the user input is in color.

Please enter your 8-digit CWID: 12345678

The digits are: 1 2 3 4 5 6 7 8
The total is: 36
The average is: 4.5

You may assume that the input has no more than eight digits and is not negative.

Reference no: EM133516226

Questions Cloud

What is the 5th most revenue generating product : What is the 5th most revenue generating product? How much revenue does the Nike men's dri-fit polo earn?
What does each say about the causes of deviance : Compare and contrast strain and control theories. What does each say about the causes of deviance? Which one is more sensible?
Officers are trained to handle emergencies first : Officers are trained to handle emergencies first, before securing the crime scene, even if valuable evidence could be lost or destroyed.
Why is constitution called living document : Why is the Constitution called (referred to as) a living document?
Write program that reads integerthat is your cwidand breaks : CSCI 428- Write a program that reads an integerthat is your CWIDand breaks it into a sequence of individualdigits.
How effect of higher minimum wage relates to unemployment : How Price Ceiling relates to the raised of minimum wage to $15? How the effect of the higher minimum wage relates to unemployment?
Examine the economic impacts of the floods in pakistan : Evidence from previous natural disasters in Pakistan suggests that economic impacts may persist. Examine the economic impacts of the floods in Pakistan.
Compare general and classic strain theory : Compare and contrast General and Classic Strain Theory. Is there any validity to either one? Why or why not?
Describe the major attributes of each of the models : Describe the major attributes of each of the models.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Activities as an individual or a small business owner

Examples of how Information Systems plays a role in your daily activities as an individual or a small business owner

  Discuss the importance of honesty in a resume and having

Discuss the importance of honesty in a resume and having a winning cover letter. Do you have an updated resume? If so, after completing this chapter's activity

  What is the access permission for the accounting folder

What is the access permission for the 'accounting' folder (directory)? Write the command to change the access permission of the accounting folder

  Create a dictionary containing course numbers

Write a program that creates a Dictionary containing course numbers and the room numbers of the rooms where the courses meet

  Describe potential disadvantages of paas

Describe potential disadvantages of PaaS. Describe how a cloud-based database management system differs from an on-site database.

  What is the percentage of attacks on networks

What is the percentage of attacks on networks that come from mobile devices? Should the analysis be different on iOS vs Android?

  Explain what are dns hijack types

To develop a better understanding of Web Essential. Define the DNS hijack, what are DNS hijack types? And how could we prevent it?

  Identify the benefits of incorporating real-world experience

Be able to apply knowledge and theory gained in their courses of study within current workplace or in their future employment. courses are.

  Design a secure staging environment for your organization

A software engineer designs, develop, tests, and evaluates the software and the systems that allow computers to execute their applications.

  What is information security governance

What is Information Security Governance? What are some of the common organizational roles involved in Security Governance?

  Describe the data security and it professionals

Briefly respond to all the following questions. Make sure to explain and backup your responses with facts and examples. This assignment should be in APA format.

  How do threats in a cloud environment multiply

How do threats in a cloud environment multiply? Do you think that advances in computer science have come at a staggering pace and computer crime has remained.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd