Does every algorithm have a running-time equation? In other words, are the upper and lower bounds for the running time (on any specified class of inputs) always the same?
In: Computer Science
Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is the length of a side. For the circles, this same value becomes the diameter. Use the meter value input to calculate the results in square (or cubic) meters and then print the answers in square (or cubic) meters. Area of a square (length times width) Area of a circle (pi times radius squared) How much bigger the area of the square is than the circle (see previous calculations) Round the length down to the next whole number of meters, compute the volume of a cube with this value as the length of its side Round the length up to the next whole number of meters, compute the volume of a cube with this value as the length of its side. You are to run the program three times using the following input values: 1000 1999.9 299.4 Please turn in the program and the outputs of running the program three times as directed. Be sure to use good style, appropriate comments and make use of constants in this program. Important Notes For the constant PI, please use 3.14159 Use the floor() and ceil() functions to round down and up respectively. For example, ceil(3.02) is 4. Be sure to #include to get access to these two functions Sample Output Your output format should look similar in style to the one below. Geometry formulas by (Your name) Enter one floating point number for length, 123.4 The number you entered is 123.4 cm or 12.34xx m. Area of square xx.xxxxxxx sq. m. Area of a circle xx.xxxxxxx sq. m. Difference is xx.xxxxxxxx sq. m. Cube volume rounded down is xx.xxxxxxxx cu. m. Cube volume rounded up is xx.xxxxxxxx cu. m. Press any key to continue
In: Computer Science
Write a program that read the input from user and convert it to binary and hex in C language.
In: Computer Science
Use the enum keyword or a C++ class to create a new type Boolean with the two values F and T defined. Use the C++ class/struct keyword and an array to create a list of pairs that cover all possible combinations of the 2 Boolean constants you defined.
In: Computer Science
Cloud computing can be implemented in several different ways, please list and describe at least three different ways.
In: Computer Science
What is project creep? Which system development methods are more prone to project creep? What could be a strategy to avoid it? (400 words approx.)
In: Computer Science
Please type answer for i can copy it. Thank you very much.
-Question 1
What is a polymorphism ?
-Question 2
Can you start an algorithm in pseudo code?
In: Computer Science
1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.
Write a complete program to display the following output:
Plan to be
spontaneous tomorrow.
2.
Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.
Write a complete program to display the results for the area of a triangle. Formula (1/2) x base x height.
In: Computer Science
I am having trouble with printing the linked list from user input. Can someone tell me what I am doing wrong.
#include <iostream>
using namespace std;
struct node
{
int info;
node*link;
node*current;
node*prev;
node * head;
node * last;
}
;
void Insert(node*&head,node*&last,int n);
int SplitList(node*&head);
void print(node*&head);
int main()
{
int num;
node*h;
node*l;
cout << "Enter numbers ending with -999"
<< endl;
cin >> num;
Insert(h, l, num);
print(h);
}
void Insert(node *&head,node*&last,int n)
{
int count = 0;
if (head == NULL)
{
head = new node;
head->info = n;
head->link = NULL;
last = head;
count++;
}
else {
last->link = new node;
last->link->info = n;
last->link->link =
NULL;
last = last->link;
count++;
}
}
void print(node*&head)
{
node *current; //pointer to traverse the list
current = head; //set current so that it points
to
//the first node
while (current->link!= NULL) //while more data to
print
{
cout << current->info
<< " ";
current = current->link;
}
}//end print
In: Computer Science
In java, write a program that asks the user to enter a character. Then pass the character to the following methods.
Example output is given below:
Enter a character
a
a is a vowel
a is not a consonant
a is equivalent to A
test case: e, E, d, D
Note: Java represents character using Unicode encoding and ‘A’ to ‘Z’ is represented by numbers 65 to 90 and ‘a’ to ‘z’ is represented by numbers 97 to 122. So to convert ‘A’ to ‘a’ you need to add (97-65) to A and then cast it to Character type since the addition will change its type to integer.
You can use the following code to read a character from console. When you call charAt(i) method for any String it returns the character at index i. The index of first character is 0, the index of second character is 1 and so on.
Scanner input = new Scanner(System.in);
char ch =input.next().charAt(0);
In: Computer Science
Imagine you are responsible for the performance improvement of an old computer system. Your boss told you that since a large budget for the new fiscal year has been approved and covers expenses with hardware upgrade you can just create a cluster computer with a large number of parallel processing units managed by some cluster operating system line MS-Windows Server 2019. You will not be able to make any changes to the software. Please, provide your recommendations for your boss regarding performance improvement by increasing parallel processing.
In: Computer Science
Your objective is to write a well-documented simple program using classes, a loop, and nested ifs to simulate an ATM using JAVA.
1. Create an ATM class with class variables name, pin, and balance, a constructor with parameters to assign values to the three instance variables, methods to get the name, pin, and balance, and methods to handle validated deposits and withdrawals ( deposit and withdrawal amounts cannot be negative, and withdrawal amount must not be greater than the existing balance).
2. In the ATMTest class, read the names, 4 digit pin numbers, and account balances of two customers into two instances of the ATM class. Display the two customers names, pins, and balances formatted.
3. Now that you have all your customers’ information start your ATM to accomplish the following within an infinite loop,
a). Display a welcome screen with your bank’s information and prompt for and read the customer entered pin.
b). Use a nested if to match the entered pin with one of the two customers’ pins. If the entered pin number matches that of one of the customers, then:
i. Welcome the customer by name and display the balance.
ii. Display option to 1. DEPOSIT, 2. WITHDRAW or 3. EXIT.
iii. If option 1 is selected, then use the instance deposit method to prompt for deposit amount, read, and add a valid deposit amount to the customer’s balance
iv. If option 2 is selected, then use the instance withdrawal method to subtract a valid withdrawal amount from the customers balance
v. If option 3 is selected, go to step a.
4. Should the entered pin number not match either of the two customers, notify the customer that the entered pin is not valid and go to step a.
5. Selection of the EXIT option must display welcome/login screen (step a).
6. Should an incorrect option be entered, notify the user and display the original welcome/login screen (step a).
In: Computer Science
Show the step by step multiplication using Booth’s Algorithm
1. -8 * 2
In: Computer Science
I need the program to continue asking the user for a positive value and NOT skip to the value for store 2 if a negative value is entered. This is the code so far: Thanks
public static void main(String[] args) {
Scanner input = new
Scanner(System.in);//scanner
int Store [] = new int[5];//array
for five int
for(int i=0;i<5;i++) { // loops
until five inputs are entered
System.out.println("Enter today's sale for store "+ (i+1) +" (negative value not allowed)");
Store [i] = input.nextInt();//allows user
input
}// end of for
System.out.println("SALES BAR CHART");
for(int i =0; i<5 ;i++) { // for loop to print out store number
System.out.println("Store "+ (i+1) +": ");
for(int j=0; j < Store [i];j =j+100) { // for loop to print number of asterisks
System.out.print("*");
}// end of
for loop for asterisks
System.out.println();
}// end of for loop
}//end of
main
}//end of class
In: Computer Science
Proofs
For this assignment, know that:
An integer is any countable number. Examples are: -3, 0, 5, 1337, etc.
A rational number is any number that can be written in the form a/b, a and b are integers in lowest terms, and b cannot equal 0. Examples are 27, 22/7, -3921/2, etc.
A real number is any number that is not imaginary or infinity. Examples are 0, 4/3, square root of 2, pi, etc.
In: Computer Science