Section 6.2 of your textbook describes incremental development. Do the exercise at the end of that section:
As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)
After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.
Include all of the following in your Learning Journal:
Part 3
Describe your experience so far with peer assessment of Discussion Assignments.
Write C++ that
(1)Convert the inputted 3-digit integer, the single digit to a hundred digit, and the hundreds digit to a single digit, and generate a new inverted number from the converted 3 digits.
(2) Arbitrary 3-digit integers are input by keyboard.
(3) When outputting the result, the required form is: original number: converted number.
4)run test the code in main
write a program
1. Prompts the user to enter a number in the range of 1 to 255 from the keypad.
2. Waits for a user to enter a number in the range.
5.4. Using the online compiler Enter the code:
#include <stdio.h>
#include <stdlib.h>
// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);
// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================
void blah2(int *i)
{
printf("In function: the value of *i is %d\n", *i);
(*i)++; // Equivalent to *i = *i + 1;
printf("In function: the value of *i after increment is %d\n\n", *i);
}
int main(int argc, char *argv[]) {
int num;
num = 3;
blah2(&num);
printf("In main(): the value of num is %d\n", num);
system("pause");
return 0;
}• Run the program.
Let’s assume Sheldon Cooper gives his friends the password for entering his
house and only let them enter his house if the password is correct. This
password must contain at least one number. If the password fails to have at
least one number, print “Leave”. Then, Sheldon runs a program that sums the
ASCII values of the numbers which were found from the password.
If the summation is an even number, then the program prints “Correct, you
may enter”.
If the summation is an odd number, then the program prints “Incorrect, you
may leave”.
Write a python program that reads a string (the password) as an input from
the user, makes a list of the characters from the input string (password),
and prints the list.
Sample Input 1:
penny06nebraska
Sample Output 1:
['p', 'e', 'n', 'n', 'y', '0', '6', 'n', 'e', 'b', 'r', 'a', 's', 'k', 'a']
Correct, you may enter
Create a program that will display magic square of numbers based on a given odd magic square size. A magic square is a square array of numbers consisting of the distinct positive integers 1,2, …, arranged such that the sum of the numbers in any horizontal, vertical, or main diagonal line is always the same number, known as the magic constant. The program should ask the user to enter an odd integer that will serve as the size of the square. The program should validate if the entered number is an odd or even number. If the number is even, the program should display an error message and ask the user to enter a number again. Once a valid size is entered, the program should automatically display the magic square.
1. Programming Problem I ( class, stack, array )
Given an array based stack of size N containing integers, tell whether it is a palindrome or not.
For example
Input: N=3
Value [ ]={1,2,1}
Output: 1
1. Programming Problem I ( Singly Linked List)
Given a singly linked list of size N, the task is to left-shift the linked list by k nodes where k is the given positive integer smaller than or equal to the length of linked list.
For example:
Input: N=5
2-> 4-> 7-> 8-> 9
K=3
Output: 8-> 9-> 2-> 4-> 7
Programming Problem I ( class, queue, Linked list )
Given a collection of integers, how do you check whether each successive pair of numbers in the collection is consecutive or not. The pairs can be increasing or decreasing.
For example, if the collection of elements are [4, 5, -2, -3, 11, 10, 6, 5] then the output should be true because each of the pairs (4, 5), (-2, -3), (11, 10), and (5, 6) consists of consecutive numbers. But if collection is [4,6,9,8] it should return false.