![Big Java Late Objects](https://www.bartleby.com/isbn_cover_images/9781119330455/9781119330455_largeCoverImage.gif)
Write declarations for storing the following quantities. Choose between integers and floating-point numbers. Declare constants when appropriate.
- a. The number of days per week
- b. The number of days until the end of the semester
- c. The number of centimeters in an inch
- d. The height of the tallest person in your class, in centimeters
a.
![Check Mark](/static/check-mark.png)
Explanation of Solution
Declaration for the first statement:
- The given statement is “The number of days per week”.
- Totally, there are seven days in a week and there is no change of days in a week.
- Hence, the number of days in a week is fixed forever.
- The declaration for storing the number of days in a week is as follows:
/* Declaration for storing the number of days in a week */
public static final int DAYS_PER_WEEK = 7;
b.
![Check Mark](/static/check-mark.png)
Explanation of Solution
Declaration for the second statement:
- The given statement is “The number of days until the end of the semester”.
- The number of days in a semester varies from time to time and the days may either increase or decrease based on the semester time-table.
- Hence, the number of days in a semester is an integer variable.
- The declaration for storing the number of days in a semester is as follows:
/* Declaration for storing the number of days in a semester */
public int daysInSemester;
c.
![Check Mark](/static/check-mark.png)
Explanation of Solution
Declaration for the third statement:
- The given statement is “The number of centimeters in an inch”.
- The number of centimeters in an inch is a fixed type of float value.
- The declaration for storing the number of centimeter in an inch is as follows:
/* Declaration for storing the number of centimeters in an inch */
public static final float CENTIMETERS_IN_INCH = 2.54;
d.
![Check Mark](/static/check-mark.png)
Explanation of Solution
Declaration for the fourth statement:
- The given statement is “The height of the tallest person in your class, in centimeters”.
- The height of the tallest person in a class is a float value since height contains decimal values.
- The height of a person varies over time.
- Hence, the height of a person is not fixed and it is float type value.
- The declaration for storing the height of the tallest person in a class is as follows:
/* Declaration for storing the height of the tallest person in a class*/
public float tallestHeight;
Want to see more full solutions like this?
Chapter 2 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Data Mining for Business Analytics: Concepts, Techniques, and Applications with XLMiner
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: Early Objects (6th Edition)
Java How To Program (Early Objects)
Problem Solving with C++ (9th Edition)
- Translate the statement into equation: When three is multiplied by one less than a number x, the result is 10 less than 5 times the number x.arrow_forwardFilling the Pool (Deprecated) Write a program that calculates the time neccessary to completely fill an empty pool with water. We will assume that the pool is rectangular and the depth is uniform. All input values in this program will be integers. Prompt the user to enter the pool dimensions - length, width, and depth (unit: feet) - as well as the rate at which water can be put into the pool (unit: gallons per minute). Using these values, calculate and display the time (in minutes) needed to fill the pool from completely empty to completely full. Note: you should calculate the volume of the pool (as cubic feet) and then determine the rate (in cubic feet per minute) that water can be put into the pool. Assume that there are 7.48 gallons in one cubic foot. Your program should run like the examples shown below: Enter pool dimensions Length: 10 Width: 8 Depth: 7 Water entry rate: 14 The pool will fill completely in 299.2 minutesarrow_forward# given a radius, find the area of a circle # use value of pi as 3.1415 def get_area_circle(r): """ what it takes radius of a circle (any positive real number) what it does: computes the area of a circle given a radius, find the area of a circle area = pi*r2 (pi times r squared) what it returns area of a circle. Any positive real number (float) """ # your code goes in herearrow_forward
- Write the statements to sum the odd integers between 1 and 99 by using a for statement. Assume that the integer variables sum and count have been defined earlier. 2.arrow_forwardDo in jupyter notebook! I'm not confident of my code please help me out .arrow_forward:Q3: Answer the following Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 5 and the value of the variable limit is -1. Give your answer as one of the values true or false. a. (count = ((0 c. (limit/count) > 7) || (limit < 20) IMI r263 LAlas Google la e 1ajall lals Juayl paearrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)