Create the appropriate variables and algorithm to calculate the following. Choose your own values for the variables. Do not enter the code on this paper. Create a program that calculates and displays the calculation. Approximate pi (π) as 3.14159.
You do not need to create a new program for each question.
If certain math equations use the same variable name, then you only need to declare it once in your main function.
Separate each problem using comments, like seen in the example below.
Example 1: Area of a square/rectangle. Formula:
int main()
{
// Example 1
float area, length, width;
length = 20;
width = 5;
area = length * width;
cout << "The area of a square with length " << length << " and width "
<< width << " is " << area << " square units.";
// Problem 1
// Problem 2
return 0;
}
In: Computer Science
int a = 1;
int b = 2;
if (a<b)
a=a+1;
b = b + a;
printf("The value of b is: %d", b);
int a = 2;
int b = 2;
if (a<b)
a=a+1;
else
a=a-1;
b = b + a;
printf("The value of b is: %d", b);
In: Computer Science
Suggest ways how to increase the number of visits for a website?
In: Computer Science
c programming
Proxy IP addresses and port number are following [Ref-1]
191.96.43.58:3129
136.25.2.43:49126
198.211.96.170:3129
198.1.122.29:80
Note: THE STRING FORMATE IS "IP_Address:Port_Number ". For example, "191.96.43.58:3129" includes an IP address and a port number. "191.96.43.58" is the IP address; "3129" is the port number.
Write a program using C Structures.
If port number is 3129, please identify these IP addresses.
In: Computer Science
Let t = [1:60];
x = [68 126 86 71 100 177 233 271 206 269 340 269 315 384 431 467 382 440 511 558 565 529 511 551 682 665 642 671 796 774 749 758 796 834 878 896 847 836 872 925 978 981 989 1041 1070 1067 1138 1167 1167 1167 1167 1194 1245 1196 1167 1165 1167 1196 1167 1134];
y =-[238 226 189 238 295 231 184 240 289 235 195 231 295 249 184 189 244 291 246 233 193 193 246 289 115 35 273 298 111 33 44 286 280 242 238 193 191 242 291 271 184 293 233 182 211 289 242 209 80 160 278 298 246 298 275 206 155 153 157 162];
1. Use cubic splines with clamped conditions to fit the data t and y.
2. Let tt=linspace(t(1),t(end),200); and evaluate the cubic spline at tt and assign the result to a variable called y1.
3. Find spline (from 1) at 45.
4. Use cubic splines with not-a-knot conditions to fit the data t and x.
5. Let tt=linspace(t(1),t(end),200); and evaluate the cubic spline at tt and assign the result to a variable called x1.
6.Plot the x1 (from part 5) against y1 (from part 2). Describe the resulting plot and show your MATLAB code and plots.
In: Computer Science
Q: Provide JavaScript code to change the font family of the first h1 heading in the document to Arial?
In: Computer Science
Show the code in matlab to display an ECG graph
(I do not want code that simply calls the ecg function in matlab
but how to write that kind of code)
In: Computer Science
A plant manager is considering buying additional stamping machines to accommodate increasing demand. The alternatives are to buy 1 machine, 2 machines, or 3 machines. The profits realized under each alternative are a function of whether their bid for a recent defense contract is accepted or not. The payoff table below illustrates the profits realized (in $000's) based on the different scenarios faced by the manager.
Alternative Bid Accepted Bid Rejected
Buy 1 machine $10 $5
Buy 2 machines $30 $4
Buy 3 machines $40 $2
Refer to the information above. Assume that based on historical bids with the defense contractor, the plant manager believes that there is a 65% chance that the bid will be accepted and a 35% chance that the bid will be rejected.
a. Which alternative should be chosen using the expected monetary value (EMV) criterion?
b. What is the expected value under certainty?
c. What is the expected value under perfect information (EVPI)?
(I need an Excel Spreadsheet)
In: Computer Science
Q: Provide the expression to create an object collection of all objects referenced by the CSS selector div#intro p?
In: Computer Science
a) Provide a comprehensive response describing naive
Bayes?
(b) Explain how naive Bayes is used to filter spam. Please make
sure to explain how this process works.
(c) Explain how naive Bayes is used by insurance companies to
detect potential fraud in the claim process.
Need 700 words discussion
Your assignment should include at least five (5) reputable sources,
written in APA Style, and 500-to-650-words.
In: Computer Science
Write a Java program to convert decimal (integer) numbers into their octal number (integer) equivalents. The input to the program will be a single non-negative integer number. If the number is less than or equal to 2097151, convert the number to its octal equivalent.
If the number is larger than 2097151, output the phrase “UNABLE TO CONVERT” and quit the program.
The output of your program will always be a 7-digit octal number with no spaces between any of the digits. Some of the leading digits may be 0.
Use a while loop to solve the problem. Do not use strings.
Sample Program Run
Please enter a number between 0 and 2097151 to convert:
160000
Your integer number 160000 is 0470400 in octal.
Please enter a number between 0 and 2097151 to convert:
5000000
UNABLE TO CONVERT
In: Computer Science
Remove the minimum element from the linked list in Java
public class LinkedList {
// The LinkedList Node class
private class Node{
int data;
Node next;
Node(int gdata)
{
this.data =
gdata;
this.next =
null;
}
}
// The LinkedList fields
Node head;
// Constructor
LinkedList(int gdata)
{
this.head = new Node(gdata);
}
public void Insertend(int gdata)
{
Node current = this.head;
while(current.next!= null)
{
current =
current.next;
}
Node newnode = new
Node(gdata);
current.next = newnode;
}
public void Listprint()
{
Node current = this.head;
while(current!= null)
{
System.out.print(current.data + " ");
current =
current.next;
}
System.out.println();
}
public void Removemin() {
// Complete this method to remove the minimum value in
a linkedlist
}
public static void main(String[] args) {
LinkedList exlist = new
LinkedList(8);
exlist.Insertend(1);
exlist.Insertend(5);
exlist.Insertend(2);
exlist.Insertend(7);
exlist.Insertend(10);
exlist.Insertend(3);
exlist.Listprint();
//output: 8 1 5 2 7 10 3
exlist.Removemin();
exlist.Listprint();
//output should be: 8 5 2 7 10
3
}
}
In: Computer Science
Write the MIPS assembly version of this C code:
int weird(char[] s, int x)
{
int i;
for (i = 0; i < x; i++) {
if (s[i] == ‘A’)
{
return power(10, i);
}
}
return -1;
}
int power(int base, int i)
{
int j = 0;
while (j < base)
{
base = base * base;
j++;
}
return base;
}In: Computer Science
Q1) Given the following sentences:
Part 1:
Part 2:
In: Computer Science
You must change file HelloWorld.java in hello-java so that the tests all pass
HelloWorld.java
package hw;
public class HelloWorld {
public String getMessage() {
return "hello world";
}
public int getYear() {
return 2019;
}
}
Main.java
package hw;
import java.util.Arrays;
public class Main {
public static void main(final String[] args) {
System.out.println("args = " + Arrays.asList(args));
final HelloWorld instance = new HelloWorld();
System.out.println(instance.getMessage());
System.out.println(instance.getYear());
System.out.println("bye for now");
}
}
TestHelloWorld.java
package hw;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TestHelloWorld {
private HelloWorld fixture;
@Before
public void setUp() throws Exception {
fixture = new HelloWorld();
}
@After
public void tearDown() throws Exception {
fixture = null;
}
@Test
public void getMessage() {
assertNotNull(fixture);
assertEquals("hello world", fixture.getMessage());
}
@Test
public void getMessage2() { // this test is broken - fix it!
assertNull(fixture);
assertEquals("hello world", fixture.getMessage());
}
@Test
public void getYear() { // this test is OK, fix HelloWorld.java to make it pass!
assertNotNull(fixture);
assertEquals(2019, fixture.getYear());
}
}
In: Computer Science