Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Create a program that when run with two numbers as CMD arguments, it prints out the difference

and product separated by space[Hint: CMD arguments need to be converted to integers]:

Sample run 1

java lab02_task02 12 3 

Output: 9 36 

Sample run 2

java lab02_task02 2 5

Output: -3 10


Create a function with a local variable. Show what happens when you try to use that variable outside the function. Explain the results.


12.8 (LAB) Fun With Branching - FINAL

For this project you will write a Java program that will run a simple math quiz. Your program will generate two random integers between 1 and 20 and then ask a series of math questions. Each question will be evaluated as to whether it is the right or wrong answer. In the end a final score should be reported for the user. (See below for how to generate random numbers).

Sample Ouptut This is a sample transcript of what your program should do. Values in the transcript in BOLD show the user inputs. So in this transcript the user inputs 33, Jeremy, 24, -16, and 80 the rest is output from the program.


Write a javascript program that asks the user to enter up to 10 golf scores, which are to be stored in an array. You should provide a means for the user to terminate input prior to entering 10 scores. The program should display all the scores on one line and report the average score. Handle input, display, and the average calculation with three separate array processing functions


Create a window (program) that will run as a standalone application. Your program must contain the following components:

 A label

 A button

 A check box

 A text field with a vertical scroll bar




Ben rents a trailer to move his furniture to his new house. The basic cost is R250 per day plus a specific amount that must be entered by him per kilometre travelled. He also has to enter the distance travelled in kilometres.

If Ben travels less than 60 kilometres, an additional surcharge of 3% is payable on the amount due for distance. However, if he uses the trailer for more than 350 kilometres, he receives a discount of 9% on the amount due for distance (Pretorius & Erasmus, 2012:65).

Write a program to calculate and display the amount due.

Hint: use object oriented programming concepts to develop your program.





Write a function in this file called nine_lines that uses the function three_lines (provided below) to print a total of nine lines.


Now add a function named clear_screen that uses a combination of the functions nine_lines, three_lines, and new_line (provided below) to print a total of twenty-five lines. The last line of your program should call first nine_lines and then the clear_screen function.


The function three_lines and new_line are defined below so that you can see nested function calls. Also, to make counting “blank” lines visually easier, the print command inside new_line will print a dot at the beginning of the line:


def new_line():


print('.')


def three_lines():


new_line()


new_line()


new_line()



Ben rents a trailer to move his furniture to his new house. The basic cost is R250 per day plus a specific amount that must be entered by him per kilometre travelled. He also has to enter the distance travelled in kilometres.


If Ben travels less than 60 kilometres, an additional surcharge of 3% is payable on the amount due for distance. However, if he uses the trailer for more than 350 kilometres, he receives a discount of 9% on the amount due for distance (Pretorius & Erasmus, 2012:65).


Write a program to calculate and display the amount due.

Hint: use object oriented programming concepts to develop your program


Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.

Example 2: Call your function from Example 1 three times with different kinds of arguments: a value, a variable, and an expression. Identify which kind of argument is which.

Example 3: Create a function with a local variable. Show what happens when you try to use that variable outside the function. Explain the results.

Example 4: Create a function that takes an argument. Give the function parameter a unique name. Show what happens when you try to use that parameter name outside the function. Explain the results.

Example 5: Show what happens when a variable defined outside a function has the same name as a local variable inside a function. Explain what happens to the value of each variable as the program runs.

Numbers in String - 1

Given a string, write a program to return the sum and average of the digits of all numbers that appear in the string, ignoring all other characters.

Input

The input will be a single line containing a string.

Output

The output should contain the sum and average of the digits of all numbers that appear in the string.

Note: Round the average value to two decimal places.

Explanation

For example, if the given string is "I am 25 years and 10 months old", the digits of all numbers that appear in the string are 2, 5, 1, 0. Your code should print the sum of all digits(8) and the average of all digits(2.0) in the new line.

Sample Input 1

I am 25 years and 10 months old

Sample Output 1

8

2.0

Sample Input 2

Tech Foundation 35567

Sample Output 2

26

5.2


LATEST TUTORIALS
APPROVED BY CLIENTS