I need to get the MATLAB calculation for this but I can't. I past the exact same thing into MATLAB R2016b Editor but it gives me error. Please write your answer and telling what is wrong with the code. What should I add or remove in this code to get the answer and calculations. Please explain step by step this is the first time ever that I am using MATLAB. Thanks
I need to get the MATLAB calculation for this but I can't. I past the exact same thing into MATLAB R2016b Editor but it gives me error. Please write your answer and telling what is wrong with the code. What should I add or remove in this code to get the answer and calculations. Please explain step by step this is the first time ever that I am using MATLAB.
Thanks
>> V=5; R1=270; R2=470; R3=560; R4=220; R5=330;
>>Req1= R4+R5;
>>Req2=1/((1/R1)+(1/R2)+(1/R3));
>>Ieq=V/(Req1+Req2);
>>Veq1=Ieq*Req1;
>>Veq2=Ieq*Req2;
>>V1=Veq1*(R4/(R4+R5));
>>V2=Veq1*(R5/(R4+R5));
>>V3=Veq2;
>>I1=V3/R1;
>>I2=V3/R2;
>>I3=V3/R3;
In: Computer Science
I am giving you some code - with basically the main function and calling a a handful of functions (one I think I've kept so you can see an example - inserting new data into the binary tree) and then displaying the tree, etc.... so basically I want you to supply the code for the corresponding functions to be called.
#include<stdio.h>
#include<stdlib.h>
/* set the Tree Structure */
struct tree {
int data;
struct tree *left;
struct tree *right;
} *root = NULL, *node = NULL, *temp = NULL;
/* Function for INSERT NEW data into the Tree */
struct tree* insert(int key,struct tree *leaf) {
if(leaf == 0) {
struct tree *temp;
temp = (struct tree *)malloc(sizeof(struct tree));
temp->data = key;
temp->left = 0;
temp->right = 0;
printf("Data inserted!\n");
return temp;
}
else {
if(key < leaf->data)
leaf->left = insert(key,leaf->left);
else
leaf->right = insert(key,leaf->right);
}
return leaf;
}
/* Function for SEARCH data from Tree */
struct tree* search(int key,struct tree *leaf)
*****COMPLETE THIS PORTION OF THE CODE FOR THE SEARCH FUNCTION*****
/* Function for FIND MINimum value from the Tree */
struct tree* minvalue(struct tree *node)
*****COMPLETE THIS PORTION OF THE CODE FOR THE FIND THE MINIMUM VALUE FUNCTION*****
/* Function for FIND MAXimum value from the Tree */
struct tree* maxvalue(struct tree *node)
*****COMPLETE THIS PORTION OF THE CODE FOR THE FIND THE MAXIMUM VALUE FUNCTION*****
/* Function for PRINT binary tree in Preorder format */
void preorder(struct tree *leaf) {
*****COMPLETE THIS PORTION OF THE CODE FOR THE PRINT PREORDER FUNCTION*****
/* Function for PRINT binary tree in Inorder format */
void inorder(struct tree *leaf)
*****COMPLETE THIS PORTION OF THE CODE FOR THE PRINT INORDER FUNCTION*****
/* Function for PRINT binary tree in Postorder format */
void postorder(struct tree *leaf)
*****COMPLETE THIS PORTION OF THE CODE FOR THE PRINT POSTORDER FUNCTION*****
/* Function for DELETE node from the Tree */
struct tree* delete(struct tree *leaf, int key)
*****COMPLETE THIS PORTION OF THE CODE FOR THE DELETE A NODE FROM THE TREE FUNCTION*****
int main() {
int key, choice;
while(choice != 7) {
printf("1. Insert\n2. Search\n3. Delete\n4. Display\n5. Min Value\n6. Max Value\n7. Exit\n");
printf("Enter your choice:\n");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("\nEnter the value to insert:\n");
scanf("%d", &key);
root = insert(key, root);
break;
case 2:
printf("\nEnter the value to search:\n");
scanf("%d", &key);
search(key,root);
break;
case 3:
printf("\nEnter the value to delete:\n");
scanf("%d", &key);
delete(root,key);
break;
case 4:
printf("Preorder:\n");
preorder(root);
printf("Inorder:\n");
inorder(root);
printf("Postorder:\n");
postorder(root);
break;
case 5:
if(minvalue(root) == NULL)
printf("Tree is empty!\n");
else
printf("Minimum value is %d\n", minvalue(root)->data);
break;
case 6:
if(maxvalue(root) == NULL)
printf("Tree is empty!\n");
else
printf("Maximum value is %d\n", maxvalue(root)->data);
break;
case 7:
printf("Bye Bye!\n");
exit(0);
break;
default:
printf("Invalid choice!\n");
}
}
return 0;
}In: Computer Science
C++ programming
Program 1:
Write a program that uses a structure to store the following weather data for a particular month:
Total Rainfall
High Temperature
Low Temperature
Average Temperature
The program should have an array of 12 structures to hold weather data for an entire year. When the program runs, it should ask the user to enter data for each month (the avg temperature should be calculated.) Once the data are entered for all the months, the program should calculate and display the average monthly rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the months they occurred in), and the average of all the monthly average temperatures.
Input validation: only accept temperatures within the range between -100 and +140 degrees Fahrenheit.
Program 2:
Modify your program so it defines an enumerated data type with enumerators for the months (JANUARY, FEBRUARY, etc.). The program should use the enumerated type to step through the elements of the array.
User interface is important!
You should post pseudocode
Your code should have appropriate comments
Your code should be well-formatted, with camel case variables
Variables should be self-descriptive
Your code should have functions (besides main!)
Your functions should only do one thing
In: Computer Science
Can someone show me a working implementation, in C source code, of a Linux shell that will use shared memory for command execution using pipes that read data from the shared memory region?
For example: you type ls -1 | wc -l into the shell and it creates child processes that read from shared memory to execute those commands.
In: Computer Science
Exception Handling in Java
In addition to what we have learned from the course materials, there are other ways to categorize exceptions in Java such as checked and unchecked exceptions. Please conduct online research on these two categories, share what you find. Of these two kinds of exceptions (checked and unchecked), which method do you prefer? Which method is easier?
In: Computer Science
Using Python:
Part 1:
Write the following function in a file called listlab.py
list4(): This function takes four formal parameters. If all four inputs are of type int and/or float, return the largest of the four inputs. Otherwise, return a list containing the four input parameters. Remember the type() function from Chapter 2.2; you may also want to use max().
Notes:
Every function must have a docstring, and variable names other than input parameters and loop control variables must have meaningful names. We will be grading for this.
Do not put a call to your function at the bottom of the file.
Part 2:
Write a Python function `make_triangle(trianglechar, triangleheight) that will return a string with an isosceles right triangle based on the two formal parameters triangle_height giving the triangle height and triangle_char that gives the symbol to be printed.
Important notes:
In: Computer Science
According to researchers at Stanford Medical School (as cited in Medical Self Care), the ideal weight for a woman is found by multiplying her height in inches by 3.5 and subtracting 108. The ideal weight for a man is found by multiplying his height in inches by 4 and subtracting 128. Using PHP and HTML 5, design and build a web page that calculates the ideal weight given the person’s gender and height. The user selects the gender from a drop down list and enters the height in a text box. Your PHP script should read all the input and calculate and display the ideal weight.
In: Computer Science
The following java files are created from this:
Objective: To learn about inheritance and understand how to inherit and override superclass methods and to be able to invoke superclass constructors
In this assignment we will simulate a bank transactions that offers the customer the following types:
Program Specification and implementation
Create a superclass BankAccount and two subclasses CheckingAccount and SavingsAccount. All the bank accounts should support getBalance, deposit and withdraw methods. Follow the below detailed specifications for each class.
BankAccount:
- Implement instance field balance
- Constructor creates an account with 0 balance.
- Constructor to create an account with an initial balance
- deposit method that takes in amount to be deposited
- withdraw method that takes amount to withdraw
- getBalance method to return the current balance in the account.
- transferMoney method that transfers money from this bank account to other bank account. This method takes two arguments (BankAccount otherAccount, double amount)
- display method that displays the account balance.
CheckingAccount:
- Constant instance fields for ALLOWED_TRANS and TRANS_FEE. Allow for 2 free transactions and $3 for additional transaction.
- instance field transactionCount (specific and new to CheckingAccount).
- Constructor to create zero balance account.
- Constructor to create an account with an initial balance
- override deposit and withdraw methods in order to increment the transaction count.
- chargeFees that charges transaction fee if any to the account at the end of the period.
SavingsAccount:
- Instance field interestRate that holds the interest rate for period.
- Constructor that sets interest rate.
- Constructor that sets rate and initial balance.
- addCompoundInterest method that adds the interest for the current period to the account balance. Deposit the interest to the account. Use this formula to calculate interest = balance * interestRate / 100.0.
TransactionsDriver:
- Instantiate a savings account name it dadsSavings with interestRate 0.3%
- Instantiate a checking account and name it kidsChecking.
- Deposit 10000 into dadsSavings account.
- Transfer 3000 to kidsChecking
- Withdraw 200 from kidsChecking
- Withdraw 400 from kidsChecking
- Withdraw 300 from kidsChecking
- Withdraw 500 from kidsChecking
- Withdraw 400 from kidsChecking
- Invoke end of period interest for the savings account
- Invoke end of period transactions fees for the checking account
- Display the final balance for dadsSavings account
- Display the final balance for kidsChecking account
- End of program
Sample Output:
At the end of these transactions the bank accounts should have the below balances
End of the period account balances
Dad's savings. Account balance: 7021.0
kid's checking. Account balance: 1188.0
Also, draw the inheritance UML diagram for the three bank accounts classes.
In: Computer Science
The mode of a set of numbers is the number that occurs most frequently in the set. For example, the set {4, 3, 6, 4, 3, 4, 1} has mode 4.
(a) (10%) Give an efficient, in-place algorithm to compute the mode of a set. Give the running time of your algorithm as a function of number of elements in the set, n. Show all work!
(b) (10%) Now suppose we know that there exists an element that occurs at least (n/2) + 1 times in the set, where n is the number of elements in the set. Give an O(n) algorithm to find the mode of this set.
In: Computer Science
WRITE A FIBONACCI SEQUENCE AS A RECURSIVE FUNCTION IN MIPS ASSEMBLY LANGUAGE
WRITE A TEST PROGRAM (“MAIN” PROGRAM)
THAT CALLS IT AT LEAST TWICE CONFORM TO ALL CODING STANDARDS
In: Computer Science
Write a comparator that sorts students by Last and First name in ascending order
In: Computer Science
How many passwords can you make with 8 characters using Uppercase, Lowercase, digits using at least one Uppercase, at least one Lowercase and at least one digit?
How many numbers between 1 and 1,000,000 (inclusive) are divisible by at least one of 3,4 and 5?
How many numbers between 1 and 1,000,000 (inclusive) are divisible by at least one of 12, 14, 15?
In: Computer Science
Write a program that prints out the ASCII number value of a statement or phrase.
The user should be prompted to enter a string of text. Then, using a loop, print the ASCII values of each letter in the entered text.
Take a screenshot of both your code and your properly executed code after you have run it. Submit the screenshots here along with your .txt file.
Hint:
The 'ord' and 'chr' functions convert to and from ASCII within python.
In: Computer Science
Write out a algorithm that sets last equal to the last element in a queue, leaving the queue unchanged. Write out a algorithm to create a copy of myQueue, leaving myQueue unchanged. Write out a algorithm Replace that takes a stack and two items. If the first item is in the stack, replace it with the second item, leaving the rest of the stack unchanged. Write out a algorithm Replace that takes a queue and two items. If the first item is in the queue, replace it with the second item, leaving the rest of the queue unchanged.
In: Computer Science
Lab-3A One-way Conditional Branching
Write MIPS assembly code to prompt and read an integer value X, and to calculate and display |X|.
Example Input/Output
Enter an integer X : 14
The absolute value is 14
Enter an integer X: -14
The absolute value is 14
Submit a single word document with the:
~MIPS code and screenshots showing:
~ ML code & Registers before execution
~ Input/Output console with at least three test data
(should cover all partitions – one positive number, one negative number, and zero)
In: Computer Science