Questions
C Program: Create a C program that prints a menu and takes user choices as input....

C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen.

The specifications must be followed exactly, or else the input given in the script file may not match with the expected output.

Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?

The first thing your program will do is print a menu of choices for the user. You may choose your own version of the wording or order of choices presented, but each choice given in the menu must match the following:

Menu Choice Valid User Input Choices
Enter/Change Character 'C' or 'c'
Enter/Change Number 'N' or 'n'
Draw Line 'L' or 'l'
Draw Square 'S' or 's'
Draw Rectangle 'R' or 'r'
Draw Triangle (Left Justified) 'T' or 't'
Quit Program 'Q' or 'q'


A prompt is presented to the user to enter a choice from the menu. If the user enters a choice that is not a valid input, a message stating the choice is invalid is displayed and the menu is displayed again.

Your program must have at least five functions (not including main()) including:

  • A function that prints the menu of choices for the user, prompts the user to enter a choice, and retrieves that choice. The return value of this function must be void. The function will have one pass-by-reference parameter of type char. On the function's return, the parameter will contain the user's menu choice.
  • A function that prompts the user to enter a single character. The return value of the function be a char and will return the character value entered by the user. This return value will be stored in a local variable, C, in main(). The initial default value of this character will be ' ' (blank or space character).
  • A function that prompts the user to enter a numerical value between 1 and 15 (inclusive). If the user enters a value outside this range, the user is prompted to re-enter a value until a proper value is entered. The return value of the function be an int and will return the value entered by the user. This return value will be stored in a local variable, N, in main(). The initial default value of this character will be 0.
  • A function for each geometric shape. Each function will take the previously entered integer value N and character value C as input parameters (You will need to ensure that these values are valid before entering these functions). The return values of these functions will be void. The functions will print the respective geometric shape of N lines containing the input character C. N is considered the height of the shape. For a line, it is just printing the character in C, N number of times, so that it creates a vertically standing line of length N. For N = 6 and C = '*', the draw line function should output:

    *
    *
    *
    *
    *
    *


    If a square is to be printed, then the following output is expected:
    ******
    ******
    ******
    ******
    ******
    ******

In case of a rectangle, we assume its width is N+5. It should look like the following:
    ***********
    ***********
    ***********
    ***********
    ***********
    ***********


    If the user selects Triangle, then it should print a left justified triangle which looks like the following:

    *
    **
    ***
    ****
    *****
    ******

Suggested steps:

  1. Create a source file with only your main() function and the standard #include files. Compile and run (it won't do anything, but if you get compile errors, it is best to fix them immediately).
  2. Write a function, called from main(), that prints the menu. Compile and test it to ensure it works properly.
  3. Add a pass-by-reference parameter to your menu() function that will retrieve the character input within the function and make it available for use within the main function. The menu function must remain a void function and not return a value.
  4. Add code to the menu() function to prompt and retrieve user input (allow any character), and assign that input character to the pass-by-reference parameter). Compile and test your code.
  5. Enclose the print menu function and user input code within a loop that will exit the program when the Quit program choice is entered. Test the logic of your code to ensure that the loop only exits on proper input ('q' or 'Q').
  6. Create five "stub functions" for the six other (non-Quit) choices. Put a print statement such as "This is function EnterChar()" or some other informative statement in the body of the function. For functions that return a value, return a specific character 'X' or number. This will be changed when the function is filled in.
  7. Within the loop in main(), create the logic to call each function based on input from the menu choice (and handle incorrect input choices). Test this logic by observing the output of the stub function statements.
  8. Fill in the logic and code for each function. Note that the Line drawing function is probably a little easier (logically) to write than the Right Justified Printing function, so you may want to write it first. Once you have the Line drawing function complete, think about what additional character(s) you will have to print (and how many) to make a square shape. Step by step, you can write functions for other shapes as well. This is the part of the lab (and the course) where you develop your skills to create algorithms that solve specific problems. These kinds of skills are not specific to C or any other language, but how to implement these algorithms are language specific.
  9. Test your program thoroughly.

In: Computer Science

"IT Security Policy Enforcement and Monitoring" Please respond to the following: Describe how monitoring worker activities...

"IT Security Policy Enforcement and Monitoring" Please respond to the following:

Describe how monitoring worker activities can increase the security within organizations.  Describe the rationale that managers should use to determine the degree of monitoring that the organization should conduct.
Explain the extent to which you believe an organization has the right to monitor user actions and traffic. Determine the actions organizations can take to mitigate the potential issues associated with monitoring user actions and traffic.

In: Computer Science

An array has an index of [5] at the starting address of 200. It has 3...

  1. An array has an index of [5] at the starting address of 200. It has 3 words per memory cell, determine loc[3],loc[4] and NE. (3 Marks: 1 mark for each)

  1. A 2-D array defined as A[10 , 5] requires 4 words of storage space for each element. Calculate the address of A[4,3] given the base address as 250
  • If the array is stored in Row-major form
  • If the array is stored in Column-major form

  1. Write a method for the following using the data structure Linked List.

void append(Node list1, Node list2)

       If the list1 is {22, 33, 44, 55} and list2 is {66, 77, 88, 99} then append(list1, list2) will change list1 to {22, 33, 44, 55, 66, 77, 88, 99}.   (5 Marks: 1mark for each correct step)

  1. Write a method for the following using the data structure Linked List.

int sum(Node list)

     If the list is {25, 45, 65, 85} then sum(list) will return 220.    (5 Marks: 1mark for each correct step)

                                                          

  1. Trace the following code showing the contents of the Linked List L after each call

      L.add(50);

      L.add(60);

      L.addFirst(10);

      L.addLast(100);

      L.set(1, 20);

      L.remove(1);

      L.remove(2);

      L.removeFirst();

      L.removeLast();    (10 Marks: 1 mark for each correct answer)

      L.addFirst(10);

  1. Compare and contrast the following data structures.
  • Array and Linked List

In: Computer Science

A standard science experiment is to drop a ball and see how high it bounces. Once...

A standard science experiment is to drop a ball and see how high it bounces. Once the “bounciness” of the ball has been determined, the ratio gives a bounciness index.

For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6, and the total distance traveled by the ball is 16 feet after one bounce. If the ball were to continue bouncing, the distance after two bounces would be 10 ft + 6 ft +6 ft + 3.6 ft = 25.6 ft. Note that the distance traveled for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up.

Write a program that lets the user enter the initial height from which the ball is dropped, the bounciness index, and the number of times the ball is allowed to continue bouncing. Output should be the total distance traveled by the ball.

Below is an example of the program input and output:

Enter the height from which the ball is dropped: 25
Enter the bounciness index of the ball: .5
Enter the number of times the ball is allowed to continue bouncing: 3

Total distance traveled is: 65.625 units.

Please explain in Python language. Thanks in advance!

In: Computer Science

"How can I connect my hadoop database or mysql database server to my d3 visual?"

"How can I connect my hadoop database or mysql database server to my d3 visual?"

In: Computer Science

Write a C++ program that takes two sets ’A’ and ’B’ as input read from the...

Write a C++ program that takes two sets ’A’ and ’B’ as input read from the file prog1 input.txt. The first line of the file corresponds to the set ’A’ and the second line is the set ’B’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog1 output.txt. Write a title before the output of each operation.
1. Union
2. Intersection
3. A - B
4. Decide if (A ⊂ B).
Program 2 – 50 points
Write a program that takes three sets ’A’, ’B’, ’C’ as input read from the file prog2 input.txt. The first line of the file corresponds to the set ’A’, the second line is the set ’B’, and the third line is the set ’C’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog2 output.txt and the standard output. Write a title before the output of each operation.
1. (A∪B)∪C.
2. A∪(B∩C).
3. (A∪B)∩(A∪C). HINTS
•You may want to use arrays.
•Pay special attention to the parentheses because they indicate the order. For example: (A ∪ B) ∪ C means to compute (A ∪ B) first, and then ∪C.
•Consider reusing the algorithms for union and intersection that you have defined already. For example, to compute (A ∪ B) ∪ C:
First, compute A ∪ B using the function that computes the union that you already defined. Let’s say that you store that result in an array R.
Then, compute R ∪ C using the function that computes the union that you already defined.

In: Computer Science

Sum all the elements in the two-dimensional array below. Print the // result to the console....

Sum all the elements in the two-dimensional array below. Print the
// result to the console.

var arr = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]

javascript

In: Computer Science

Please solve all. I don't have any more questions left. I will give thumbs up. For...

Please solve all. I don't have any more questions left. I will give thumbs up.

For Online Textbook Store & Payment System, please identify each of the requirements as a functional requirement/property or non-functional requirement/property. For every non-functional property/requirement, please add a remark to explain why.

10. The bookstore manager will be able to access the system in order to view sales summary reports.

11. Payments processed through the system are electronically transferred into the store’s bank account.

12. Bank sends monthly statements of account activity to the bookstore.

13. The system must be available for access 24/7.

14. Customers can select a preferred web browser to access the system.

15. A back up will be perform on the customer information and order information on a weekly basis.

16. Customers are not allowed to share their accounts with others.

17. Customers can send their comments via email to the company.

18. Customers can call Shipping Department to track their orders.

19. Customer records will be stored on a remote database server.

20. For security reasons, the maximum session duration cannot exceed 5 minutes.

In: Computer Science

Give an example of a class containing attributes and operations. Instantiate (create) an object of your...

Give an example of a class containing attributes and operations. Instantiate (create) an object of your class

In: Computer Science

Below is the code i got from another expert Q&A but im not allowed to use...

Below is the code i got from another expert Q&A but im not allowed to use 'del' function because i didnt learn it.

+ I need to use recursion not list comprehenshion.

Please carefully go over the instructions

def add(vals1,vals2):
  
  
    if (len(vals1))==0:
        return []
    else:
        x = vals1[0]+vals2[0]
        del vals1[0],vals2[0]
      
      

        return [x]+add(vals1,vals2)

This is the question

Write a function add(vals1, vals2) that takes as inputs two lists of 0 or more numbers, vals1 and vals2, and that uses recursion to construct and return a new list in which each element is the sum of the corresponding elements of vals1 and vals2. You may assume that the two lists have the same length. For example: >>> add([1, 2, 3], [3, 5, 8]) result: [4, 7, 11] Note that: The first element of the result is the sum of the first elements of the original lists (1 + 3 –> 4). The second element of the result is the sum of the second elements of the original lists (2 + 5 –> 7). The third element of the result is the sum of the third elements of the original lists (3 + 8 –> 11) And this is why i have for the code. But i have not learned del function and im afraid i cant use it. im only allowed to use arithmetic operators: +, -, *, **, /, //, % boolean operators: <, >, <=, >=, ==, != comments and docstrings conditional statements: if, elif, else len() logical operators: and, or, not list operations: indexing, slicing, skip-slicing, concatenation, construction print() recursion string operations: indexing, slicing, concatenation, duplication type() def add(vals1,vals2):

In: Computer Science

How do we define the stack ADT, including its operations? Typed please.

How do we define the stack ADT, including its operations? Typed please.

In: Computer Science

Give an example that explains the generalization versus specialization in object orientated context.

  1. Give an example that explains the generalization versus specialization in object orientated context.

In: Computer Science

Pretend that I (your professor) have enough free time to create an elaborate database for one...

Pretend that I (your professor) have enough free time to create an elaborate database for one of my fall face-to-face classes that contained the following information:

1) daily attendance

2) grades for every assignment and exam (including date of assignment)

3) age of students

4) every contact that each student made with me including email and office visit

5) voluntary class participation per student

6) whether students were freshmen, sophomore, junior, or senior

7) how many hours each student worked at a job each week

Write a 300-word essay discussing what ways I (the professor) could examine the relationship of this data to learn more about this class. Also, is there any additional data that would be interesting to have to examine this class?

Example: "I would like to analyze the relationship between class attendance and grade. I suspect that, on average, the students who do not show up to class are less likely to perform well..."

In: Computer Science

In your initial discussion post, recommend two options or approaches that cloud service providers can implement...

In your initial discussion post, recommend two options or approaches that cloud service providers can implement to protect subscriber data. Keep in mind, there is a balance to be struck between relying on trusted processes and security policies, and achieving operational agility --especially when subscriber data is at stake.

In: Computer Science

complete a pseudocode for the program specifications be sure to declare the contants and it contains...

complete a pseudocode for the program specifications be sure to declare the contants and it contains only 1 if-else statement


you need a program that will calculate the net pay for the employees. Input consists of the employee’s first name, employee’s last name, hourly pay rate, hours worked. The gross pay is based on the hours worked. If the hours worked is over 40, then the overtime pay is one and a half times the hourly pay rate for all hours over 40 plus the regular pay. The deductions will be computed as 20% of the gross pay. Output will consist of the employee’s first name, employee’s last name, hourly pay rate, hours worked, regular pay, overtime pay, gross pay, deductions, and net pay. ​

In: Computer Science