1 for each of the problems listed below write the c++ program while using WHILE loop structures
A program will display each term in the following sequence
1 -10 100 -1000 10000 -100000 1000000
A program will calculate and display the corresponding celsius temperatures for the given Farenheit ones from 0f to 212 f (hint c=(f-32/1.8)
In: Computer Science
2D object transformations(Use NetBeans IDE)
Task: create a program that realizes 2D transformations for 2D
object with at least three
control points:
• Movement
o The user must be able to input the movement step (in
pixels)
o The movement can be controlled with keyboard cursor keys
(←↑→↓)
• Scaling
o The user must be able to input the scaling parameters
o The scaling should be controlled with keyboard keys (for example
"Page
Up", "Page Down")
• Rotation
o The user must be able to input the angle of rotation (in
degrees)
o The user must be able to input a point, around which the object
will rotate
(X, Y)
o Automatic rotation must be implemented, the user pushes a button
and the
object begins to rotate around the given point (animation using
timer)
In: Computer Science
You are given a text file that contains the timetable for buses that travel a college campus. The first line of the file contains the name for each stop on the bus system separated by colons. Each following line contains the times using a 24-hour clock at which each bus in the system will arrive at a bus stop, also separated by colons.The timetable will have the following format:
Edinburgh:Danderhall:Dalkeith:Edgehead:Pathhead:Blackshiels:Oxton:Carfraemill:Lauder:Earlston:Leaderfoot:Newtown St Boswells:St Boswells:Clintmains:Kelso
0850:0911:0918:0930:0933:0939:0953:0955:1001:1015:1025:1029:1032:1038:1055
1150:1211:1218:1230:1233:1239:1253:1255:1301:1315:1325:1329:1332:1338:1355
1350:1411:1418:1430:1433:1439:1453:1455:1501:1515:1525:1529:1532:1538:1555
1610:1633:1640:1652:1655:1701:1715:1717:1723:1737:1746:1750:1753:1803:1820
1750:1811:1818:1830:1833:1839:1853:1855:1901:1919:1925:1929:1932:1938:1955
2000:2021:2028:2037:2040:2046:2100:2102:2108:2121:2126:2130:2133:2138:2155
Write a program in Python that reads this file and outputs a row for each bus stop, showing the times when a bus arrives at that stop
In: Computer Science
Convert signed integer 0xACE9 to binary and decimal.
Convert unsigned integer0xACE9 to binary and decimal.
In: Computer Science
In: Computer Science
The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current calendar year. The premium is computed by taking the decade of the customer’s age, adding 15 to it, and multiplying by 20.
For example, a 34-year-old would pay $360, which is calculated by adding the decades (3) to 15 and then multiplying by 20.
Write an application that prompts a user for the current year then a birth year. Pass both to a method that calculates and returns the premium amount, and then display the returned amount.
Insurance.java
In: Computer Science
Outline the process that occurs when a hardware interrupt is generated by a disk controller. Set the context for the interrupt disk read and describe how an interrupt handler would address the event.
In: Computer Science
finish the java programming
Create a new class named MyCharacterListTools that provides the API shown below.
This class does not need a constructor nor will any user-defined constructor be called by the
provided code in MainClassQ1.java.
◦ MyLinkedList createCharacterList(String str) – This method is to
return a MyLinkedList whose data items are the characters of str. All of the
characters must appear in the list and in the same order as they are given in str.
◦ void removeNonLetters(MyLinkedList list) – This method is to remove
from the list any spaces, numbers and punctuation characters (this is to be done inplace).
Letters of the alphabet are to be left in the list in the same order they were given.
For example, if the list contained {H_e_l_l_o_ _W_o_r_l_d_!} then after calling this
function, the list would hold {H_e_l_l_o_W_o_r_l_d}. You may use the built-in Java
static method Character.isLetter(char ch) to test whether the list items are
letters.
◦ boolean testEquality(MyLinkedList l1, MyLinkedList l2) – This
method is to compare two MyLinkedLists for equality. Two lists are considered
equal if their contents are the same and in the same order. Letter case should not be
observed (i.e. 'A' is equal to 'a', 'B' is equal to 'b', etc...). If the two lists are equal then
return true. Return false otherwise. The static built-in Java methods
Character.toLowerCase(char ch) and Character.toUpperCase(char
ch) may be used in this method.
In: Computer Science
Write a C++ program that displays the current time
In: Computer Science
inserting a node after given node.
DLL::DLL(int x){ // constructor, initializes a list with one new
node with data x
DNode *n = new DNode (x);
first = n;
last = n;
size=1;
}
DNode::DNode( int x){
data = x;
next = NULL;
prev = NULL;
}
void DLL::addFirst(int x) {
DNode* tmp = new DNode(x);
first = tmp;
last = first;
}
void DLL::insertAt(int ind, int x) {
int i = 0;
DNode *tmp = first;
DNode *tmp2;
while(i < ind && tmp != NULL) {
i += 1;
tmp2 = tmp;
tmp = tmp->next;
}
if (tmp != NULL) {
DNode *tmp3 = new DNode(x);
tmp3->next = tmp;
tmp->prev = tmp3;
tmp2->next = tmp3;
tmp3->prev = tmp2;
}
}
command to get out put:
codelist.addFirst(0);
codelist.printList();
codelist.insertAt(1,1);
codelist.printList();
codelist.insertAt(2,3);
codelist.printList();
codelist.insertAt(2,2);
codelist.printList();
codelist.push(4);
codelist.printList();
codelist.insertAt(2,42);
codelist.printList();
desired output:
0,
0, 1,
0, 1, 3,
0, 1, 2, 3,
0, 1, 2, 3, 4,
0, 1, 42, 2, 3, 4,
actual output:
0,
0,
0,
0,
0, 4,
0, 4,
In: Computer Science
Please code this in C
In this project, we shall simulate the operations of an ATM machine.
Suppose you’re in charge of this simulation and here is a scenario of what is required to do:
The customer will be assigned a random number for his/her balance.
First, the customer is prompted to enter his personal identification number pin (for this case study, we test only if this pin is formed by 4 digits! otherwise, a message like “Invalid PIN, try again . . .” will be displayed) and the user is re-prompted to enter the pin. The customer is given three chances to enter his pin. If he/she fails during the three trials you display a message like “Sorry you can’t continue, contact your bank for assistance!”
If the pin is correct (formed by 4 digits), then the system will ask the customer for the receipt ( 1 for YES and 2 for NO ) and a menu will be displayed containing five possible options to choose from: Fast Cash, Deposit, Withdraw, Balance and Get Card Back.
Here is the explanation of each of the 5 options:
Get Card Back: Display the message “Goodbye! “and exit the program.
Fast Cash: Let the customer choosing the amount of cash from a menu similar to the following:
Press:
1 --> $20.00 $40.00 <-- 2
3 --> $80.00 $100.00 <-- 4
Withdraw: Prompt the user for the amount of money he/she would like to withdraw and make the sure that he/she has enough money for that!
Deposit: Prompt the customer for the amount of deposit.
Balance: Just display the amount of money the customer has.
Don’t forget to print the receipt if the customer wants one.
Sample execution: bolded text represents the user entry
Virtual Bank at West
WELCOME
Enter Pin: 245
Invalid PIN, Re-enter Pin: 5487
(clear screen )
Receipt y or Y -> Yes No <- n or N
Enter choice: N
(Clear screen)
CHOOSE FROM THE FOLLOWING
1 -> Fast Cash Withdraw <- 2
3 -> Deposit Check Balance <- 4
5 -> Get Card Back
Enter your choice: 4
(Clear screen)
Your Balance is : $124.3
1 -> Another Transaction Get Card Back <- 2
Enter your choice: 1
(Clear screen)
CHOOSE FROM THE FOLLOWING
1 -> Fast Cash Withdraw <- 2
3 -> Deposit Check Balance <- 4
5 -> Get Card Back
Enter your choice: 2
(Clear screen )
Enter amount (enter 0 to cancel): 300.00
Sorry not enough balance
Enter amount (enter 0 to cancel): 30.00
Take your cash…
(Clear screen)
Your Balance is: $124.32
1 -> Another Transaction Get Card Back <- 2
Enter your choice: 1
(Clear screen)
CHOOSE FROM THE FOLLOWING
1 -> Fast Cash Withdraw <- 2
3 -> Deposit Check Balance <- 4
5 -> Get Card Back
Enter your choice: 8
Invalid Entry
(Clear screen)
CHOOSE FROM THE FOLLOWING
1 -> Fast Cash Withdraw <- 2
3 -> Deposit Check Balance <- 4
5 -> Get Card Back
Enter your choice: 5
(Clear screen)
THANK FOR USING OUR VIRTUAL BANK SYSTEM
GOODBYE. . .
In: Computer Science
Why is emergency management software so important? How important is software to emergency managers?
In: Computer Science
Write a program that creates three vector objects IN C++. Fill the first two objects with 25 floating-point numbers using a for loop as follows: 1. fill the first vector object with the loop counter value; 2. fill the second vector object with the loop counter value squared; 3. finally, write a for loop that adds the corresponding elements in the first two vectors, and puts the result in the corresponding element of the third vector. Display all three vectors using the format “for counter; element + element = element”.
In: Computer Science
Python Programming Question
1. Implement the median-of-three method for selecting a pivot value as a modification to quickSort (name this function
mo3_quickSort). Prepare test cases for your mo3_quickSort .function
QuickSort function:
def quickSort(alist):
quickSortHelper(alist,0,len(alist)-1)
def quickSortHelper(alist,first,last):
if first
splitpoint = partition(alist,first,last)
quickSortHelper(alist,first,splitpoint-1)
quickSortHelper(alist,splitpoint+1,last)
def partition(alist,first,last):
pivotvalue = alist[first]
leftmark = first+1
rightmark = last
done = False
while not done:
while leftmark <= rightmark and alist[leftmark] <=
pivotvalue:
leftmark = leftmark + 1
while alist[rightmark] >= pivotvalue and rightmark >=
leftmark:
rightmark = rightmark -1
if rightmark < leftmark:
done = True
else:
temp = alist[leftmark]
alist[leftmark] = alist[rightmark]
alist[rightmark] = temp
temp = alist[first]
alist[first] = alist[rightmark]
alist[rightmark] = temp
return rightmark
alist = [54,26,93,17,77,31,44,55,20]
quickSort(alist)
print(alist)
2. Prepare and run an experiment to verify the following hypothesis.
Canonic quickSort is as fast as mo3_quickSort when processing large lists of unsorted integers.
In: Computer Science
Terrain navigation is a key component in the design of unmanned aerial vehicles (UAVs). Vehichles such as a robot or a car, can travel on land; and vehiches such as a drone or a plane can fly above the land. A UAV system contains an on board computer that has stored the terrain information for the area in which it is to be operated, Because it knows where it is at all times (often using a global positioning system (GPS) receiver), the vehicle can then select the best path to get to a designed spot. If the destination changes, the vehicle can refer to its internal maps and recompute the new path. The computer software that guides these vechicles must be tested over a variety of land formations and topologies. Elevvation information for large grids of land is available in computer databases. One way of measuring the "difficulty" of a lanad grid with respect to terrain navigation is to determine the number of peaks in the grid, where a peak is a point that has lower elevations all around it. For this problem, we want to determine whether the value in grid position [m] [n] is peak. Assume that the values in the four positions shown are adjacent to grid position [m] [n]
grid [m-1] [n] | ||
---|---|---|
grid [m][n-1] | grid [m][n] | grid [m][n+1] |
grid [m+1] [n] |
Write a program in C PROGRAMMING that reads elevation data from a data file named grid1. txt. (this file you have to create and name it as grid 1.txt.) data as shown below which represent elevation for a grid that has 6 points along the side and seven points along the top ( the peaks have been highlighted and underlined):
5039 5127 5238 5259 5248 5310 5299
5150 5392 5410 5401 5352 5820 5321
5290 5560 5490 5421 5530 5831 5210
5110 5429 5430 5411 5459 5630 5319
4920 5129 4921 5821 4722 4921 5129
5023 5129 4822 4872 4794 4862 4245
Then prints the number of peaks and their locations. Assume that the first line of the data file contains the number of rows and the number of columns for the grid of information. These values are then followed by the elevation values, in row order. The maximum size of the grid is 25 rows by 25 columns.
Hints:
In: Computer Science