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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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