This assignment is mainly to practice Selection programming structure. That is IF ... THEN ... ELSE ... END IF and IF ... THEN ... ELSEIF ... ELSEIF .... END IF
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
DISPLAY HowMuch
If intNumber<= 100 Then
intNumber = intNumber * 2
ElseIf
intNumber> 500 Then
intNumber = intNumber * 3
End If
thanks for the question, here are the answers with explanation
===================================================================================
Case 1: When i=1 and HowMuch=0
i<5 will be True; hence HowMuch = 0+1 that is equal to 1
So it will print 1
===================================================================================
Case 2: When i=5 and HowMuch=0
i=5 will be True; hence howMuch = 0-5 that is equal to -5
So it will print -5
===================================================================================
Case 3: i=6 and HowMuch=0
Else will be True: hence HowMuch = 0+3 that is equal to 3
So it will print 3
===================================================================================
Assume intNumber initially contains 50.
Since intNumber is 50, the below condition will be executed
If intNumber<= 100 Then
intNumber = intNumber * 2
So intNumber = 50*2 that is equal to 100
So after the structure is executed intNumber will contain 100
===================================================================================
Assume intNumber initially contains 500.
neither intNumber<=100 nor intNumber >500 is meet, so the
code below these two conditions wont get executed
So, intNnumber will retain the original number and will contain
500
===================================================================================
Assume intNumber initially contains 1000
Since intNumber is >500, the below condition will be
executed
intNumber> 500 Then
intNumber = intNumber * 3
So intNumber = 1000*3 that is equal to 3000
So after the structure is executed intNumber will contain 3000
===================================================================================
This assignment is mainly to practice Selection programming structure. That is IF ... THEN ... ELSE...
This assignment is mainly to practice Iteration ( we review this week) and Selection programming structures. That is a FOR loop and IF ... THEN ... ELSEIF ... ELSE ... END IF structures. Open a blank file (use Word or a text editor). Type your name and CS 3 in the beginning of the file. Save the file as yourlastname-firstname-ProgIteration.docx or save the file as yourlastname-firstname-ProgIteration.txt. Preferably in CS 3 folder that you already created other assignments. What is the...
I am learning programming in JAVA. Please help me with this programming assignment. Your lab assignment this week is to build a little math program to help kids practice their addition and subtraction. You will create a menu and have the kid select what kind of math problem they want to solve. Once the kid selects what kind of problem. Randomly generate two numbers, display the problem and allow the kid to enter the answer. If the answer is correct....
Visual Basic 1.Order the integer data types by their relative size and the decimal-type data types by their relative size. Give an example that can be encapsulated by that level, but not ones lower than it. 2. How do the following structures differ in execution? Give an example of a task that might benefit from each structure. a. IF THEN b. IF THEN ELSE c. IF THEN ELSEIF THEN d. IF THEN ELSEIF THEN ELSE e. SELECT CASE 3.Write a function that will determine that...
1. Which of the following is declared correctly and will not result in an error, assuming x 2 and y307 a) for (var j - 10; j < 80, - ) b) for (var 1 - x, c) for (var 1- d) for (var j = x 1 y ) + 5) -80 y: 1 - 5 /*) <= 80 • y: 1 -- 5) 2. The multiple-selection statement is used to handle decision making and can be used to...
JAVA PROGRAMMING File Name You can not just take the file and send it. When Polycarp trying to send a file in the social network "Codehorses", he encountered an unexpected problem. If the name of the file contains three or more "x" (lowercase Latin letters "x") in a row, the system considers that the file content does not correspond to the social network topic. In this case, the file is not sent and an error message is displayed. Determine the...
. . In this programming assignment, you need to write a CH+ program that serves as a very basic word processor. The program should read lines from a file, perform some transformations, and generate formatted output on the screen. For this assignment, use the following definitions: A "word" is a sequence of non-whitespace characters. An "empty line" is a line with no characters in it at all. A "blank line" is a line containing only one or more whitespace characters....
QUESTION 1 What will be displayed as a result of executing the following code? int x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points QUESTION 2 What will be the displayed when the following code...
if (a > 0) if (b < 0) x = x + 5; else if (a > 5) x = x + 4; else x = x + 3; else x = x + 2; Refer to Code Segment Ch 05-1. If x is currently 0, a = 0 and b = -5, what will x become after the statement shown is executed?
Please answer and explain thank you. Question 1 What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x); Group of answer choices 45678.259 0,045,678.26 45,678.26 45,678.3 Question 2 What will be printed when the following code is executed? double x = 45678.259; String output = String.format("%,.1f", x); System.out.println(output); Group of answer choices 45678.259 45,678.259 45,678.26 45,678.3 Question 3 What will be the value of ans after the following code has been executed? int ans=0;...
Overview The purpose of this assignment is to practice functional programming in the Racket Programming Language and to also reinforce the notion of the list as a universal data structure, by implementing various operations on binary search trees. Specification A binary search tree is a binary tree which satisfies the following invariant property: for any node X, every node in X's left subtree has a value smaller than that of X, and every node in X's right subtree has a...