Write java programs that use command-line input

Assignment Help Computer Engineering
Reference no: EM132217583

Computational structures

Write Java programs that use command-line input and call the following integer functions.

All calculations for each function should be encapsulated within the function. Use a long datatype instead of int for all input and output variables.

Do NOT use string variables in any of the algorithms. A sample main program will be provided as an example. Turn in source code for each function, along with test output.For each of the above functions, state whether or not the function is one-to-one. Justify your answers.

If a function is not one-to-one, show two inputs that have the same output. 1. SumOfDivisors: The input variable X is a positive integer. The function should return as Y the sum of the divisors of X. For example, if X is 10, then Y is 1+2+5+10=18. If X is 23, then Y is 24.

Whenever Y = 2X, X is called a perfect number. Test your function with the following inputs:X = 6 X = 277 X = 3443 X = 8128 X = 298760

Reference no: EM132217583

Questions Cloud

Create an application : The CalcDouble procedure should multiply the first Integer variable's value by 2 and then store the result in the second lnteger variable.
What is the book value of klingons assets today : If all the current assets were liquidated today, the company would receive $2.6 million cash. What is the book value of Klingons assets today
Create a program to play game of tic tac toe : Using two dimensional arrays, create a program to play game of Tic Tac Toe. Your program enables you to play against the computer.
Calculate the area of a rectangular shaped wall : write a C++ program that calculates the area of a rectangular shaped wall and then calculates the required cost to paint that wall.
Write java programs that use command-line input : CS 2130: Write Java programs that use command-line input and call the following integer functions.
Develop the book and volume classes : You are required to develop the Book and Volume classes, then write an application (DemoVolume) to test your classes.
Write a public static method named q that takes an arraylist : Write a public static method named q that takes an ArrayList of type Double and returns an int.
Write a program to compute the mileage given by a vehicle : Write a program to compute the Mileage given by a vehicle. Mileage = (new_odometer - old_odometer)/(gallons_gas) // illustrating how ‘for' loop works.
Write a statement to call template function defined : Assume dList[50] declares an array of 50 doubles, and is properly initialized. Write a statement to call template function defined above to sort the array.

Reviews

Write a Review

Computer Engineering Questions & Answers

  The areas of your site that you find or expect

Designers can use a type selector to apply rules to every instance of the element in the document.

  Print the sum of the first n prime numbers

Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided.

  Write a short program that will prompt the user for a number

Write a short program that will Print out whether the number is a perfect square (the product of two equal integers)

  How you need to change the interface and implementation file

Describe how you need to change the interface and implementation files shown in Displays 11.1 and 11.2. You need not write out the files in their entirety.

  Operation for circular linked list

Write down an algorithm or code segment for searching the circular linked list for a given item. Write down an algorithm or the code segment for locating nth successor of an item within a circular linked list (nth item which follows the given item ..

  How much attenuation of second harmonic of transmit signal

The sensitivity of a commercial GPS receiver is -130 dBm. How much attenuation of the second harmonic of the transmitted signal is required?

  Determining the format of the number to be entered first

Determining the format of the number to be entered first - If the number entered cannot be expressed as 8 or 16 bits according to the selected bit value, the program - The sign bit varies depending on whether the count is positive or negative.

  Write function that compares two words and prints all letter

Write a function that compares two words and prints all the letters that appear in both. Change the encode function so that spaces are simply skipped.

  For this discussion respond to the followingdiscuss the use

for this discussion respond to the followingdiscuss the purpose of subnetting.discuss the use of arp tcp udp ftp http

  Describe what you believe to minimum set of branch condition

Describe what you believe to be a minimum set of branch conditions. Modify the branching hardware described on page 161 to complete your design.

  What is project scope

What is project scope? Why is it important to define project scope clearly?

  Create a dictionary entry with the number

Write a program, dCount(lst,n), which will take a 2-dimensional list which consists of a number (lst[i][0]) and string (lst[i][1]).

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