Calculate the average of the values contained in the integer

Assignment Help Computer Engineering
Reference no: EM132217606

Assignment

1. Write a complete program whose class name is Hello that displays Hello, world on the screen (with the quotation marks). Also in the program, declare an integer constant, MONTHS_IN_YEAR, whose value is 12, and display that number followed by months on a separate line.

2. Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.

3. Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared.
Creating objects

4. Declare a reference variable of type File named myFile.

5. Declare a variable named myMenu suitable for holding references to Menu objects.

6. Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile.
invoking methods

7. Assume that dateManager is a reference to an object that has a method named printTodaysDate, that accepts no arguments and returns no value. Write a statement that calls printTodaysDate.

8. Assume that dataTransmitter is a variable that refers to an object that provides a method, sendSignal that takes no arguments. Write the code for invoking this method.

9. Assume that dataTransmitter is a variable that refers to an object that provides a method, named sendObject. There is one argument for this method, a reference to a Customer object. Assume that there is a reference to an object of type Customer, in a variable called john_doe. Invoke the method, using this reference as your argument.

10. Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off, and setting the desired temperature. The following methods provide these behaviors: turnOn and turnOff, which accept no arguments and return no value, and setTemp, which accepts an int argument and returns no value. Assume there is a reference variable officeAC of type AirConditioner.

Create a new object of type AirConditioner and save the reference in officeAC. After that, use the reference to turn on the new air conditioner object and set the desired temperature to 69 degrees.
Invoking static methods

11. Write the code for invoking a static method named sendDouble, provided by the DataTransmitter class. There is one double argument for this method. Assume that a double variable called x has already been declared and initialized to some value. Use this variable's value as an argument in your method invocation.

12. Assume the availability of a class named Logger that provides a static method, printLarger that accepts two int arguments and returns no value. Two int variables, sales1 and sales2, have already been declared and initialized. Write a statement that calls printLarger, passing it sales1 and sales2.

Reference no: EM132217606

Questions Cloud

Give the associated range of destination host addresses : Consider a datagram network using 8-bit host addresses. Suppose a router uses longest prefix matching and has the following forwarding table.
Create a text based fantasy arena combat game : Build a Fantasy Fighting arena combat game in C++ you will be designing and implementing a store with purchasable goods .
Write some statements that use a while loop to associate s : Associate the sum of the non-negative values in the list numbers with the variable sum .
Write the definition of a class player containing : A constructor that takes two int arguments and assigns the first one to counter and the second one to limit.
Calculate the average of the values contained in the integer : Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double.
Write a program that prints the 128-character ascii table : Write a program that prints the 128-character ASCII table. It should print the table in eight tab-separated columns.
Write a statement that increments the value of the int : Write a statement that increments the value of the int variable total by the value of the int variable amount.
Prompt the user for a string that contains two strings : Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered.
How many users are on the local system : Which character is used to separate fields in /etc/passwd? How many fields are used to describe each user? How many users are on the local system?

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