Question 1)
The Following OOP Problem must be completed in C++
Consider a bubble gum dispenser.The dispenser releases one bubble gum at a time until empty. Filling of the dispenser adds a positive number of bubble gums.
A) Write an Abstract Data Type for a bubble gum dispenser
B) Draw the UML class diagram
C) Define a C++ class for a bubble gum dispenser object
D) The number of bubble gums in the dispenser is private
E) Write an implementation for the class
F) Write a simple test program to demonstrate that your class is implemented correctly
In: Computer Science
5.9 Online shopping cart (Java)
Create a program using
classes that does the following in the zyLabs developer below. For
this lab, you will be working with two different class files. To
switch files, look for where it says "Current File" at the top of
the developer window. Click the current file name, then select the
file you need.
(1) Create two files to submit:
Build the ItemToPurchase class with the following specifications:
(2) In main(), prompt
the user for two items and create two objects of the ItemToPurchase
class. Before prompting for the second item, call
scnr.nextLine(); to allow the user to input a new
string. (2 pts)
Ex:
Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10
(3) Add the costs of the two items together and output the total
cost. (2 pts)
Ex:
TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13
In: Computer Science
need this in C++
Start
Declarations
number currentTuition
number futureTuition
number interestRate
number numYears
number year
output "Please enter current tuition: "
input currentTuition
output "Please enter interest rate (e.g. 9.0 for 9 percent): "
input interestRate
output "Please number of years for tuition: "
input numYears
output “Tuition at year 1 is “, currentTuition
futureTuition = currentTuition
for year = 2 to numYears
futureTuition = futureTuition * (1 + interestRate/100)
output “Tuition at year “, year ,”is “, futureTuition
endfor
Stop
In: Computer Science
In: Computer Science
Let a , b , c be three integer numbers. Write a C++ program with a functions
void rotate1(int* a,int* b,int* c)
void rotate2(int& a,int& b,int& c)
such that a -> b , b -> c and c -> a. Thus we use two different approaches (pointers in rotate1 and references in rotate2).
In: Computer Science
The threat on the Texas power grid has escalated. An imminent attack is expected coming from multiple fronts. This includes expected coordinated attacks including DDOS, malware, and physical attacks on substation equipment. To secure the grid against such an attack, formulate an effective defense scenario and strategies to counter the cyber attack. This includes deceiving, confining, and neutralizing the attackers before it actually occurs, keeping the grid up.
In: Computer Science
Data Structure
6. Write a recursive routine that will have an integer array and an index as parameters and will return the count of all odd integers. You may assume that the index starts out at the END of the array.
12. Write the implementation function for ArrayBag in C++, called bagLess, that takes an ItemType of item as parameters and use it count items in the current bag that are less than the item (hint: use toVector)
13. Write a sum function in C++ for LinkedBag of integers (must use pointers to traverse the linked list) that will return a sum of all values.
15. Write a Grammar that starts with a letter or a group of letters (assume uppercase), has an '?' or '!', and ends with a letter or a group of letters (uppercase)
16.
Given: e + f / (a – b) * c
Write out the prefix form
In: Computer Science
Using Java
Write a program that reads a file of numbers of type int and outputs all of those numbers to another file, but without any duplicate numbers. You should assume that the input file is sorted from smallest to largest with one number on each line. After the program is run, the output file should contain all numbers that are in the original file, but no number should appear more than once. The numbers in the output file should also be sorted from smallest to largest with one number on each line.
Your program should not assume that there is a fixed number of entries to be read, but should be able to work with any number of entries in both the input and output files.
- Do not use arrays, lists, arraylists, linked lists, sets, maps, trees, or any other multi-element data structure.
program should read in and write out numbers from the input and output files at the same time, eliminating duplicates from the output file as you go.
Your program should obtain both file names from the user. For the original (input) file, create a text file that stores one number per line with several duplicates in sorted order. The output file should be created by your program. When completed, your program should display on the console:
|
Sample console dialog, where input from the user is underlined in italics
Enter input file name or full path: numbers.txt Enter output file name or full path: output.txt There were 18 numbers input, 10 output, and 8 duplicates. |
In: Computer Science
please provide steps as you solve the question.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Prove that the following languages are not regular using the pumping lemma.
a. ? = {? ?? ?? ? | ?, ? ≥ ?}
b. ? = {? ∈ {?, #} ∗ | ? = ??#??# … #?? ??? ? ≥ ?, ?? ∈ ? ∗ ??? ????? ?, ??? ?? ≠ ?? ??? ????? ? ≠ ?
} Hint: choose a string ? ∈ ? that contains ? #’s.
In: Computer Science
python: modify an image (just show me how to write the two functions described below)
1.One way to calculate the contrast between two colours is to calculate the brightness of the top pixel (the average of the red, green and blue components, with all three components weighted equally), and subtract the brightness of the pixel below it. We then calculate the absolute value of this difference. If this absolute value is greater than a threshold value, the contrast between the two pixels is high, so we change the top pixel's colour to black; otherwise, the contrast between the two pixels is low, so we change the top pixel's colour to whiteDevelop a filter named detect_edges that returns a copy of an image, in which the copy has been modified using the edge detection technique described in the preceding paragraphs. This filter has two parameters: an image and a threshold, which is a positive number.
2.As before, we calculate the contrast of two pixels by subtracting the brightness values of the pixels and calculating the absolute value of the difference. We change a pixel's colour to black only if the contrast between the pixel and the one below it is high (i.e., the absolute value of the difference exceeds the filter's threshold attribute) or the contrast between the pixel and the one to the right of it is high. Otherwise, we change the pixel's colour to white.
A simple algorithm for performing edge detection is: for every pixel that has a pixel below it, check the contrast between the two pixels. If the contrast is high, change the top pixel's colour to black, but if the contrast is low, change the top pixel's colour to white. For the bottom row (which has no pixels below it), simply set the pixel to white.
In: Computer Science
In Java...create a class Realestate.java with the following fields: location, price, and description. Create a class RealestateFinder.java that reads in real estate data from a CSV file (RealestateList.csv). Then provide the user with the following options: Sort per Price, Sort per Location, and Exit. Use ArrayList and Arrays.sort to perform the sorts and display the data to the user.
In: Computer Science
How many total bits are required for a 1-way set associative cache with 16 KB of data and 8-word blocks, assuming a 32-bit address?
In: Computer Science
Please no plagiarism. Must be in your own words.
Do you feel that countries and companies need explicit strategies for technology development, given the tremendous amount of largely spontaneous creativity that occurs today, often in areas where new technologies are not expected to exert a great influence? Why or why not?
In: Computer Science
There are threats all around us, so it is essential to have a robust plan in place to help mitigate the damage to a business from these threats. Select any one of the threats that have been covered in the Business Continuity Chapter of the text and develop a Disaster Recovery Plan (DRP). The plan at a minimum should include a summary of the threat, a risk assessment, a mitigation strategy, how you will restore the IT resource, and contingencies. The DRP should be no longer then 500-750 words.
In: Computer Science
WRITE THIS JAVA CODE IN PSEUDOCODE!! import java.util.Scanner; public class License { public static void main(String[] args) { char correctAnswers[] = {'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A'}; char userAnswers[] = new char[correctAnswers.length]; Scanner scanner = new Scanner(System.in); for (int i = 0; i < userAnswers.length; i++) { String answer = ""; System.out.printf("Question #%d. Enter your answer( A, B, C or D): ", i + 1); do { answer = scanner.nextLine(); if (!(answer.equals("A") || answer.equals("B") || answer.equals("C") || answer.equals("D"))) { System.out.print("You didnt enter it A, B, C or D. Enter again: "); } } while (!(answer.equals("A") || answer.equals("B") || answer.equals("C") || answer.equals("D"))); userAnswers[i] = answer.charAt(0); } int correctlyAnswered = getCorrectAnswerCount(correctAnswers, userAnswers); System.out.printf("\nYou answered %d questions correctly.\n", correctlyAnswered); System.out.printf("You answered %d questions incorrectly.\n\n", userAnswers.length - correctlyAnswered); if (correctlyAnswered != userAnswers.length) { displayIncorrectlyAnsweredQuestions(correctAnswers, userAnswers); } if(correctlyAnswered>=15) System.out.println("You have cleared the exam. Congratulations."); else System.out.println("You have failed the exam. Sorry!"); } private static void displayIncorrectlyAnsweredQuestions(char[] correctAnswers, char[] userAnswers) { System.out.print("Questions Wrongly Answered: "); for (int i = 0; i < correctAnswers.length; i++) { if (correctAnswers[i] != userAnswers[i]) System.out.print((i + 1) + " "); } System.out.println(); } private static int getCorrectAnswerCount(char[] correctAnswers, char[] userAnswers) { int count = 0; for (int i = 0; i < correctAnswers.length; i++) { if (correctAnswers[i] == userAnswers[i]) count += 1; } return count; } }
In: Computer Science