What is a well-documented program

Assignment Help JAVA Programming
Reference no: EM132430559

1. What is a well-documented (commented) program, "RelativelyPrimeArray," that takes an integer command-line argument "n" and creates an (n+1)-by-(n+1) Boolean array "rpa" such that rpa[i][j] (for i,j>0) is true if i and j are relatively prime (have no common factors), and is false otherwise. It should then output as is shown by the sample run below. If the indexes i,j (for i,j>0) are equal, it should output a single space. If the indexes are not equal, then it should output a "T" character if the array element specified by the indexes is true or an "F" character if it is false. [MO2.1, MO2.2]

A sample run would be as follows. 

> java RelativelyPrimeArray 9 

  1 2 3 4 5 6 7 8 9 

1  T T T T T T T T 

2 T  T F T F T F T 

3 T T  T T F T T F 

4 T F T  T F T F T 

5 T T T T  T T T T 

6 T F F F T  T F F 

7 T T T T T T  T T 

8 T F T F T F T  T 

9 T T F T T F T T

2. What is a well-documented (commented) program, "Distribution100," that takes integer command-line arguments. The first argument would be the count of the remaining arguments that are between 1 and 100 (inclusive of 1 and 100). It then prints out the count of numbers entered that are less than or equal to 50 and the count of numbers that are greater than 50 from those remaining arguments. [MO2.1, MO2.2]

A sample run would be as follows.

> java Distribution100 15 5 82 2 1 74 19 47 64 39 77 25 99 100 1 10 

9 numbers entered are less than or equal to 50. 

6 numbers entered are greater than 50.

3. What is a well-documented (commented) program, "Average," that reads in lines from standard input with each line containing a name and three integers and then uses "printf()" to print a table with a column of the names, the integers, and the average of the three integers accurate to two decimal places. The user will specify the number of names as a command-line argument and then type in that number of names (along with three integers for each name). [MO2.1, MO2.2]

A sample run would be as follows. 

> java Average 4 

Joe 3 5 2 

Tim 4 1 5 

Jane 6 3 2 

Jack 8 3 5

<Ctrl-D>  

Joe 3 5 2 3.33 

Tim 4 1 5 3.33 

Jane 6 3 2 3.67 

Jack 8 3 5 5.33

Reference no: EM132430559

Questions Cloud

Displays a corresponding comment as prime number : Problem: Write a Java program with the following specifications: 1. The program should display a menu as follows:
Text file of strings representing numbers : Design a program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen.
Preparing the balance sheet for the fiscal year : The following is the Frederick Company's adjusted Trial Balance. Use this information to practice preparing the Balance Sheet for the fiscal year
Discuss ways in which the world of the elderly shrinks : Some social scientists discuss the fact that the elderly live in a "shrinking world." Discuss ways in which the world of the elderly shrinks.
What is a well-documented program : What is a well-documented (commented) program, "RelativelyPrimeArray," that takes an integer command-line argument "n" and creates
Identify the social location of Brett Kavanaugh : Identify the social location of Brett Kavanaugh Identify his in-group, who would belong to this group? Identify the out-group, who would belong to this group?
How many objects can you make from a public class : Can a java program have more than one file open at the same time?
Programming with objects-object-oriented analysis and design : Discuss each of these concepts and how they relate to each other and provide a practical example drawn from your own personal experience.
How would personal belief determinism affect of crime : Do you believe that every event has a cause and that free actions are possible? If so, are these beliefs compatible?How would personal belief determinism affect

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java class to accept a user-s hourly rate of pay

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay - withholding).

  Design and implement a class named modules

Design and implement a class named Modules that may contain several Module objects. Write a short application to test your Modules class.

  Write ruby function prime

(2) Using prime? (n) write Ruby function primearray(n) that returns an array that contains all prime numbers that are less than n.

  Write a program that reads customers information from file

User upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects).

  What makes a program easy to modify

Describe the order of magnitude of the code section using Big(O) notation and Explain the relationship between dynamic storage allocation and recursion.

  Write a program that simulates a simple calculator

Write a program that simulates a simple calculator. It reads two integers and a character. If the character is a +, the sum is printed; if it is a -, the difference is printed; if it is a *, the product is printed; if it is a /, the quotient is pr..

  What access modifier do you use to restrict access

Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?

  Implement a hash table with collisions

Implement a hash table with collisions solved by: (1) Quadratic probing (2) Double hashing.

  Why is top down design beneficial

This and that is a powerful keyword used in Java. How is it used and why is it so beneficial? Give an example in your explanation.

  Write an interactive java application that input the words

Your job is to write an interactive java application that would ask the user to input the words that you want to generate acronyms for and the program is going to spit out the appropriate acronym in all capital letters.

  Int variable with a boolean variable

In java programming Can we compare int variable with a boolean variable?

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

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