write java program that prompt the user to enter two numbers .the program display all numbers between that are divisible by 7 and 8 ( the program should swap the numbers in case the secone number id lower than first one
please enter two integer number : 900 199
Swapping the numbers
224 280 336 392 448 504 560 616 672 728 784 840 896
i need it eclipse
In: Computer Science
Write a C Program to finish the following requirements: Convert a double number to its hexadecimal form
1. The double number x is located between 0 and 1000(0<=x<=1000),e.g.678.345
2.The double number with the hexadecimal form contains 6 significant digits. e.g." 5D.32FA45".
3.The double number with the hexadecimal form is represented by a string(or a character array), e.g."5D.32FA45".
Please write as simple as possible because I am a freshman in C! And please give me some clues!
Thanks!
In: Computer Science
Can someone fill in the blanks?
using namespace std;
double approxPi;
// define the signal handler function
______
______
______
______
______
int main(int argc, char* argv[])
{
pid_t childPid;
double inside = 0;
double total = 0;
double oldPi = 0.0;
switch (childPid = fork()) { // fork the process
case -1:
cerr << "forking error";
exit(0);
case 0: // child process
// register SIGUSR1 handler
______
______
______
while (1) {
// calculate the approximate value of pi using the Monte Carlo
method
for (int i = 0; i < 10000; ++i) {
double x = (double)rand() / RAND_MAX;
double y = (double)rand() / RAND_MAX;
if (x * x + y * y <= 1) {
inside++;
}
total++;
}
approxPi = 4.0 * inside / total;
}
default: // parent process
sleep(5);
______; // send the SIGUSR1 signal to the child
}
return 0;
}
In: Computer Science
In: Computer Science
a. Design a binary-to-octal converter.
b. Design a logic circuit by which the following arithmetic
expression can be calculated and show how X = 9 - 5
c. Write a short note on the data distributor circuit.
In: Computer Science
You plan to visit your dentist for an emergency. You will be required to follow a specific process before you can see your dentist. Write an algorithm and draw a flowchart for this problem.
In: Computer Science
FOR SAGE PYTHON
Koch snowflake: The Koch snowflake can be constructed by starting with an equilateral triangle, then recursively altering each line segment as follows: Step 1: divide the line segment into three segments of equal length. Step 2: draw an equilateral triangle that has the middle segment from step 1 as its base and points outward. Step 3: remove the line segment that is the base of the triangle from step 2. After one iteration of this process, the resulting shape is the outline of a hexagram. The Koch snowflake is formed by repeating this process over and over again (in principle, infinitely many times, but in practice we will stop after a certain number of iterations). Your goal is to write a program which draws the Koch snowflake, following these instructions:
(a) Don’t attempt to draw any lines yet, you should do that only at the very end. Instead, you should create a list of all vertices (points) which you want to connect in the end.
(b) Write a function, called koch_bump(), which takes as input two tuples (the coordinates of two points P = (x1, y1) and Q = (x2, y2)), and which returns a list of 4 tuples, starting with P and followed by the three points between P and Q which form the ”bump” pointing outwards from the line segment. Hint: Linear Algebra (vector geometry) can make this a lot easier, but you can also figure out the coordinates of the needed points using basic high school geometry
(c) Write a function, called koch_iteration(), which takes as input a list of tuples (think of these as the vertices of the equilateral triangle you start with), and which returns a new list of tuples which contains all points after applying the subdivision process exactly once. To do this, go through the given list of points, and apply the function koch_bump() to each two adjacent ones (don’t forget to also apply it to the last and first points in the list): For example, if the list contains the points A, B, C, you should call koch_bump() on the pairs (A, B), (B, C), and (C, A) — but you should write the function so that it can deal with an arbitrary number of points in the list.
(d) Write a function, called koch_snowflake(), which takes as input a list of tuples (the vertices of the starting polygon), an integer maxiter, and the optional argument filled (which defaults to False) and which produces the picture of the Koch snowflake obtained by applying koch_iteration() maxiter times, starting with the vertices given in the list. Hint: To connect a list of points (tuples) by line segments, you can use the polygon2d() command. Read its documentation, you probably want to use the options fill=filled,axes=False.
(e) Write a function, called regpolygon(), which takes as input an integer k, and which returns a list of k tuples which are the vertices of the regular polygon with radius 1. In other words, the k points should lie on the unit circle and should be evenly spaced apart. Hint: Use cos α and sin α, where α is a multiple of 2π/k.
(f) Draw the Koch snowflake after 5 iterations when starting with an equilateral triangle. Hint: Use koch_snowflake(regpolygon(3),5).
(g) Draw the Koch snowflake after 5 iterations when starting with a square.
(h) Draw the Koch snowflake after 5 iterations when starting with a pentagon.
(i) Repeat the last three parts, but with the option filled=True.
In: Computer Science
In: Computer Science
java NetBeans
Class Entry:
Class PhoneBook
Class TestPhoneBook
In: Computer Science
Write a Problem analysis chart & an algorithm, create an IPO and draw a flowchart for solving a Quadratic equation.
In: Computer Science
does the exception handler run in kernel mode?
In: Computer Science
2. Write a program to do the following: • ask the user to input the size of an array of integers and allocate space for the array • ask the user to input the integer values for the array and store these values into the array • calculate and display the sum and the average of elements of the array
In: Computer Science
Write a Little Man program that outputs the sum of n number of input values.
In: Computer Science
Write a query that returns the department id and the number of employees (in the associated department) salary is over $2500 and, at the end, result page has to show only department ids that have more than 5 employees in it. Please Note: (we don't interest all of department ids in our grouping action and also we don’t want to see any kind of total employee number in the result page we want to see limited result set)
Hint1: SELECT part has to be like below. SELECT department, COUNT(*) as "Number of employees"
Hint2: Don't forget the use of WHERE and please distinguish the WHERE and HAVING
SQL SCHEMA (oracle):
https://pastebin.com/raw/vaesFLWM
In: Computer Science
(Sort ArrayList) Write the following method that sorts an ArrayList:
public static <E extends Comparable<E>>
void sort(ArrayList<E> list)
Write a program to test the method with three different arrays:
Integers: 2, 4, and 3;
Doubles: 3.4, 1.2, and -12.3;
Strings: "Bob", "Alice", "Ted", and "Carol"
This program is similar to the Case Study in the book: Sorting an Array of Objects
the language is in java
In: Computer Science