Starting from:
$30

$24

Homework 7 SOlution

Files to submit: bin_str.c

Time it took Matthew to Complete: 10 mins




All programs must compile without warnings when using the -Wall and -Werror options
Submit only the files requested

Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
Your program must match the output exactly to receive credit.

Make sure that all prompts and output match mine exactly.
Easiest way to do this is to copy and paste them
All input will be valid unless stated otherwise
Print all real numbers to two decimal places unless otherwise stated
The examples provided in the prompts do not represent all possible input you can receive.
All inputs in the examples in the prompt are underlined

You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza



Restrictions




No global variables are allowed
Your main function may only declare variables, call other functions, and assign variables values.
You must solve this problem recursively
Write a program called bin_str.c that completes a binary number. A binary number is made up of 0's and 1's but the input strings you will receive can also contain x's. An x represents a digit that can be either a 0 or a 1. Your program should display all the possible binary digits that can be formed. For example the string x1x0 could represent either 0100, 0110, 1100, or 1110.



Your program should accept the binary string as a command line argument
You MUST solve this program RECURISIVELY



Examples

./bin_str.out 0110 0110



./bin_str.out 01x0 0100 0110



./bin_str.out xx 00 01 10 11












./bin_str.out 101x100x11x 10101000110 10101000111 10101001110 10101001111 10111000110 10111000111 10111001110 10111001111



Files to submit: foo.c

Time it took Matthew to Complete: 10 mins




All programs must compile without warnings when using the -Wall and -Werror options
Submit only the files requested

Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
Your program must match the output exactly to receive credit.

Make sure that all prompts and output match mine exactly.
Easiest way to do this is to copy and paste them
All input will be valid unless stated otherwise
Print all real numbers to two decimal places unless otherwise stated
The examples provided in the prompts do not represent all possible input you can receive.
All inputs in the examples in the prompt are underlined

You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza



Restrictions




No global variables are allowed
Your main function may only declare variables, call other functions, and assign variables values.
You must solve this problem recursively
You may only make ONE recursive call in the recursive cas



For this assignment you will be writing a program to calculate the value of the function foo. The value of foo is defined as follows

foo(0)=2

foo(1)=3

foo(2)=5




foo(n)= foo(n−1)+ foo(n−2)+ foo(n−3)




Specifications




The value of n is accepted through the command line



You may only make 1 recursive call in the recursive case
1. If you don't you will fail many of the tests with a timeout issue

You must solve the problem recursively



Example




1. ./foo.out 2

foo(2) = 5

2. ./foo.out 10

foo(10) = 697




Files to submit: heist.c

Time it took Matthew to Complete: 15 mins




All programs must compile without warnings when using the -Wall and -Werror options
Submit only the files requested

Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
Your program must match the output exactly to receive credit.

Make sure that all prompts and output match mine exactly.
Easiest way to do this is to copy and paste them
All input will be valid unless stated otherwise
Print all real numbers to two decimal places unless otherwise stated
The examples provided in the prompts do not represent all possible input you can receive.
All inputs in the examples in the prompt are underlined

You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza



Restrictions




No global variables are allowed
Your main function may only declare variables, call other functions, and assign variables values.
You must solve this problem recursively
Your college loans are really high and you have fallen on hard times. In order to get the money to pay them off you are considering robbing a jewelry store. You've recorded the weight and value of each item and you are are planning on bringing your favorite backpack with you to carry off the loot. You want to walk out the store with your backpack containing the maximum value possible and so have decided to write a program to help you figure out what the value of that backpack is.




Specifications




Your program should ask the user for the following information in this order



The maximum amount of weight their bag can hold



The number of items in the jewelry store



The value and weight of each item



Hints




In order to solve this problem you should try out every possible valid combination of items that will fit in the backpack and then see which backpack is the most valuable.



Examples

Enter the maximum amount of weight that your bag can hold: 100
Enter the number of items that are in the jewelry store: 3 Enter your items, one per line (value weight):

47 10

50 97

45 5

They most profitable heist will net you $92 in total.

Enter the maximum amount of weight that your bag can hold: 100
Enter the number of items that are in the jewelry store: 4 Enter your items, one per line (value weight):

24 33

14 62

22 23

1200 99

They most profitable heist will net you $1200 in total.

More products