
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.

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.

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.

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.

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
Vector Mechanics For Engineers
Modern Database Management
Database Concepts (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
- I need to make a parallel version of this sequential code.arrow_forwardBenefits of using arrays as instance variables: What are the advantages of incorporating arrays as instance variables within a class? Initializing and managing arrays: How do you initialize and manage arrays within class constructors and mutators (setters)? Example of using arrays as instance variables: Share an example where you have used arrays as instance variables and discuss its application in a real-world scenario. Common mistakes with arrays as instance variables: What are some common mistakes to avoid when working with arrays as instance variables? Information hiding violations: What is the potential violation of information hiding when using arrays as instance variables? How can this be resolved?arrow_forwardDo you think that computers should replace teachers? Give three references with your answer.arrow_forward
- Is online learning or face to face learning better to teach students around the around the world? Give reasons for your answer and provide two references with your response. What are benefits of both online learning and face to face learning ? Give two references with your answer. How does online learning and face to face learning affects students around the world? Give two references with your answer.arrow_forwardExplain Five reasons if computers should replace teachers. Provide three references with your answer. List three advantages and three disadvantages face to face learning and online learning may have on children. Provide two references with your answer.arrow_forwardYou were requested to design IP addresses for the following network using the address block 10.10.10.0/24. Specify an address and net mask for each network and router interfacearrow_forward
- For the following network, propose routing tables in each of the routers R1 to R5arrow_forwardFor the following network, propose routing tables in each of the routers R1 to R5arrow_forwardUsing R language. Here is the information link. http://www.cnachtsheim-text.csom.umn.edu/Kutner/Chapter%20%206%20Data%20Sets/CH06PR18.txtarrow_forward
- Using R languagearrow_forwardHow can I type the Java OOP code by using JOptionPane with this following code below: public static void sellCruiseTicket(Cruise[] allCruises) { //Type the code here }arrow_forwardDraw a system/level-0 diagram for this scenario: You are developing a new customer relationship management system for the BEC store, which rents out movies to customers. Customers will provide comments on new products, and request rental extensions and new products, each of which will be stored into the system and used by the manager for purchasing movies, extra copies, etc. Each month, one employee of BEC will select their favorite movie pick of that week, which will be stored in the system. The actual inventory information will be stored in the Entertainment Tracker system, and would be retrieved by this new system as and when necessary. Example of what a level-0 diagram looks like is attached.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L




