Questions:
Restrictions:
In: Computer Science
PLEASE ANSWER IN C
Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been declared as well. Assume further that the user has just been presented with the following menu:
(Yes, this menu really IS a menu!)
Write some code that reads a single character (S or T or B) into choice. Then the code prints out a recommended accompanying drink as follows:
If the value of age is 21 or lower, the recommendation is "vegetable juice" for steak, "cranberry juice" for trout, and "soda" for the burger. Otherwise, the recommendations are "cabernet", "chardonnay", and "IPA" for steak, trout, and burger respectively. Regardless of the value of age, your code should print "invalid menu selection" if the character read into choice was not S or T or B.
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"
In: Computer Science
What are the inputs and outputs for functional analysis and allocation? Explain how inputs are transformed to outputs. In what life cycle phase(s) is functional analysis and allocation performed?
In: Computer Science
python
Write a Loop class. The contents of a loop object are represented internally as a simple python list with the following additional instance variables:
loop - a python list containing the elements of the loop list
head - which stores the index of the first element of the loop list
current - which stores the index of the last element of the loop list
size - which stores how many actual elements are in the loop
max - which stores the max number of elements that can be in a loop
Note that current and head will be the same when the list is empty, and when the list contains a single element.
And methods:
__init__(self, max) - which constructs an empty loop object;
__str__(self) - which returns a string representing the loop object as described below;
add(element) - which adds the element to the end of the loop (i.e. at the position of current + 1)
empty() - which says whether there are any elements in the loop;
count() - which says how many elements currently are in the loop;
delete() - which returns the first item from the loop (i.e. at the position of head) and removes it from the loop;
max() - returns the max number of elements allowed in the loop.
__init__ initializes the empty locations in the loop list to None. Assume that max is always greater than the number of elements to be in the loop at any one time. When an element is being added to an empty loop, it always goes into the first location (index 0) in the loop list and head and current are reset to 0.
If an attempt is made to delete() from an empty loop then delete() returns None. When an element is deleted from the loop its value is changed to None. Remember, your code needs to properly maintain the correct values of loop, head, current and size.
__str__ formats the loop object data as follows:
<max> <size> <head> <current> <loop list>
For example, after:
x = Loop(4)
x.add(1)
x.add(3)
x.delete()
print(x)
"print(x)" prints out:
4 1 1 1 [None, 3, None, None]
For example:
Test | Result |
---|---|
x = Loop(5) print(x) |
5 0 0 0 [None, None, None, None, None] |
x = Loop(5) x.add(3) print(x) |
5 1 0 0 [3, None, None, None, None] |
x = Loop(3) x.add(3) x.add(2) print(x) |
3 2 0 1 [3, 2, None] |
x = Loop(3) x.add(3) x.add(2) x.delete() print(x) |
3 1 1 1 [None, 2, None] |
x = Loop(3) x.add(2) x.add(5) x.add(3) x.delete() x.add(7) print(x) |
3 3 1 0 [7, 5, 3] |
In: Computer Science
In: Computer Science
Edsger Dijkstra, an early contributor to the development of software engineering, stated that Testing can only show the presence of errors, not their........
Select one:
a. absence
b. None of the other options.
c. causes
d. presence
The following is an example of errors originated in the requirements analysis phase:
Select one:
a.
Defects in the used algorithms.
b. Misunderstanding of the client’s instructions.
c.
User interface and procedure errors.
d. Algorithmic and processing defects.
Fill out the missing word:
Software testing is a .............. process carried out by a specialized testing team.
Select one:
a. necesssary
b. random
c. formal
d. sufficient
In software testing, a software unit, several integrated software units or an entire software package are examined by ..................... the programs on a computer.
Select one:
a. writing
b. running
c. simulating
d. proving
There is no single testing technique that is guaranteed to find all defects in all programs.
Select one:
True
False
An exhaustive testing method is an effective testing strategy since it is guaranteed to find all possible defects.
Select one:
True
False
The main difference between debugging and testing is:
Select one:
a. Debugging use tools while testing does not.
b. Testing aims to locate source of the defect and to fix it while debugging aims to discover defects.
c. Debugging aims to locate the source of the defect and to fix it while testing aims to discover defects.
d. Debugging is a static V&V method while testing is a dynamic one.
A programmer forgets to add two numbers in the code. This is an example of a:
Select one:
a. A software failure.
b. A software error.
c. A software defect.
d. None of the other choices.
A tester finds out in a test case that the actual result differs from the expected result. This is an example of:
Select one:
a. A software defect.
b. A software failure.
c. None of the other choices.
d. A software error.
An example of a white-box testing technique is:
Select one:
a. Review.
b. Code coverage.
c. Equivalence class partitioning.
d. Inspection.
In: Computer Science
IN C ++ PLEASE CODE FOR BUBBLE SORT---Add code to sort the bowlers. You have to sort their parallel data also. Print the sorted bowlers and all their info .
You can use a bubble sort or a shell sort. Make sure to adjust your code depending on whether or not you put data starting in row zero or row one.
Sort by Average across, lowest to highest. The highest average should then be on the last row..
When you sort the average, you also have to move the names and scores, this is the reason you can't use a built-in sort.
Names score1 score2 score3 average score
---------------------------------------------------------------------------
Linus too good 100 23 210 111.00
Charlie brown 1 2 12 5.00
Snoopy 300 300 100 233.33
Peperment Patty 223 300 221 248.00
Pig Pen 234 123 212 189.67
Red Headed Girl 123 222 111 152.00
Marcey 1 2 3 2.00
keith hallmark 222 300 180 234.00
anna hallmark 222 111 211 181.33
roxie hallmark 100 100 2 67.33
Average for first score: 152.60
Average for second score: 148.30
Average for third score: 126.20
248.0 was bowled by Peperment Patty
2.0 was bowled by Marcey
....FINAL TABLE SHOULD LOOK LIKE THIS ....
-After sort-
Names score1 score2 score3 average score
---------------------------------------------------------------------------
Marcey 1 2 3 2.00
Charlie brown 1 2 12 5.00
roxie hallmark 100 100 2 67.33
Linus too good 100 23 210 111.00
Red Headed Girl 123 222 111 152.00
anna hallmark 222 111 211 181.33
Pig Pen 234 123 212 189.67
Snoopy 300 300 100 233.33
keith hallmark 222 300 180 234.00
Peperment Patty 223 300 221 248.00
In: Computer Science
In: Computer Science
Discuss at least 4 common tasks of operating systems. Explain how Windows might accomplish one of the tasks and how the Mac OS or Linux might accomplish it differently.
In: Computer Science
I get an error 1452 saying it cannot add or update my foreign key. is there a way to fix this
In: Computer Science
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data. . You are NOT trying to find mistakes
What does this do? Desk
Checking #3: Explain the intent of this
pseudocode. Be as specific as
possible.
List the data you use for example data.
Use this textbox to explain the pseudocode/ code intent. Include any test data used: |
start
Declarations
num idNumber
num itemsSold
num itemsValue
num ITEM_MIN = 200
num VALUE_MIN = 1000
string MSG = “High Performer!”
housekeeping()
detail()
finish()
stop
housekeeping()
output “Salesperson program”
input idNumber, itemsSold, itemsValue
return
detail()
if itemsSold > ITEM_MIN AND itemsValue > VALUE_MIN then
output MSG
return
finish()
output “End of program”
return
In: Computer Science
Explain any two Software tests used in software development. (10)
In: Computer Science
Method: DoublyLinkedList reverse(DoublyLinkedList list) Reverse() method accepts a DoublyLinkedList of Character as the argument, reverses the elements in the list, and returns the resulting list. For example:
The given list is
'a' 'b' 'c' 'd' 'e'
The return list should be
'e' 'd' 'c' 'b' 'a'
How can we do this in Java?
In: Computer Science
Write a C program that prints the Grade of each student in a class based on their mark. The program must also print the average mark of the class.
The program must prompt (ask) the user for the mark of a student (out of 100).
The program must then print the mark entered and the grade received based on the table below.
Grade |
Range |
A |
85 to 100 inclusive |
B |
75 to 85 inclusive |
C |
60 to 70 inclusive |
D |
50 to 60 inclusive |
F |
Less than 50 |
For example “The student mark is 87 and their grade is A.”
This must be done repeatedly until a mark of -1 is entered.
The average mark of all of the class must then be shown.
For Example “The average mark of the class is 34.23.”
Note: To calculate the average, you must add up (total) all of the marks and then divide by the number of students (number of marks entered)
In: Computer Science