PSUEDOCODE: Using whatever looping mechanism makes sense to you, create an algorithm that will display timing for a stopwatch.
Keep the following in mind:
In: Computer Science
Write code that classifies a given amount of money (which you store in a variable named amount), specified in cents, as greater monetary units. Your code lists the monetary equivalent in dollars (100 ct), quarters (25 ct), dimes (10 ct), nickels (5 ct), and pennies (1 ct). Your program should report the maximum number of dollars that fit in the amount, then the maximum number of quarters that fit in the remainder after you subtract the dollars, then the maximum number of dimes that fit in the remainder after you subtract the dollars and quarters, and so on for nickels and pennies. The result is that you express the amount as the minimum number of coins needed.
Please show me how to do it in the jupyter notebook.
In: Computer Science
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
In: Computer Science
Stack ADT
What would you say is the most important drawback of using the stack that should be considered before choosing it for use in a real application? Typed out please.
In: Computer Science
C++... How do I separate a C String, entered by a user, by commas? Say they enter Frog,Wolf,Spider... I want a array containing the elements {Frog, Wolf, Spider}
thanks
Here's my idea so far...
cout << "Enter the column names (c of them), each name seperated by a comma" << endl;
char colNames[100];
cin >> colNames;
for (int i = 0; i < 99; ++i){
if (colNames[i] == ','){
//parse the string, assign that string name to that column
}
}
cout << colNames << endl;
In: Computer Science
Create an Entity relationship diagram (ERD) conceptual model for this case.
VINEYARD HOLDINGS AND GRAPE VARIETIES
VVI’s vineyard sources its wine from ten plots of land in separate locations from two
acres to twenty acres. Each vineyard has its own unique name, such as Rattlesnake
Canyon, Red Fox, Theresa’s, etc. and is either owned by VVI or by an independent third
party. Each is managed by a single employee. No employee manages more than one
vineyard. The location and size, measured in acres, of each vineyard is recorded. Each
vineyard is dedicated to the growing of a single grape variety per vintage year. However,
over time a particular vineyard may be replanted to a different grape variety, depending
on market demand for particular types of wine. The winery maintains a record of these
plantings.
VVI currently grows six different grape varieties: Cabernet Sauvignon, Merlot,
Zinfandel, Pinot Noir, Chardonnay, and Sauvignon Blanc. Information that is specific for
each grape variety and must be recorded includes the juice conversion ratio, a measure of
how much juice, on average, can be extracted from a given weight of a grape variety. The
wine storage requirement, which is the type of storage container (typically either stainless
steel tank or oak barrel) used to hold the juice while it ferments into wine, is also
recorded for each grape variety, as is the wine aging requirement, which is the measure of
how long the wine produced from the juice should be stored before bottling. Certain
measures related to the grapes that vary with the specific vintage year harvest are also
recorded including the vineyard the grapes come from, the total amount (weight) of
grapes harvested, and the ripeness of the grapes (expressed in % sugar).
WINE PRODUCTS AND BOTTLES
Information on the wines created from the grapes must, of course, be recorded. Each
wine produced is given a unique identification number in addition to its name. Other
information recorded for each wine is its vintage year, category (e.g., dry red, dessert,
etc.), and percent alcohol, a legal requirement. Also recorded is the employee in charge of
making that wine. Wine makers may be responsible for more than one wine at a time.
The composition of a wine may be entirely from a single grape variety or may be a blend
of more than one variety. The proportion of juice from each grape variety for each wine
produced must be recorded. Several of the grape varieties are used in more than one
blended wine. None of VVI wines are vineyard specified; that is, the wines are labeled by
the grape varieties contained in the wines only, without reference to specific vineyard
plots.
The wines are sold in case lots. The winery refers to these case lots as products. A
product is a specific wine in a specific bottle size in a specific case quantity sold at a
specific price. Each product type is given a unique product identification number. VVI
does not sell partial cases, nor does it mix wines or bottle types in a single case.
The bottles used for the wines vary in capacity, shape, and glass color. Each bottle type is
assigned a unique bottle identification code. VVI maintains an inventory count of how
many of each bottle type is currently on hand in their warehouse. The winery prefers to
keep at least a month’s worth of bottle inventory on hand. The usual cost per bottle is also
recorded for each bottle type to aid in pricing the products and as a guide in calculating
expected future bottle order costs.
The bottles must be purchased from outside glass vendors. Each of these vendors is
assigned a unique identification number. In addition to this number, each vendor’s name,
address, and phone are recorded. Also recorded, for each vendor, is the name of the
principal contact (i.e., account representative) at the vendor that handles the VVI account.
Bottles are acquired from the vendors by placing orders. Some bottle types may be
ordered from more than one vendor. Each order involves only a single vendor but may
include more than one bottle type. Usually orders are filled completely by the vendors,
but occasionally an order must be filled with multiple shipments, due to a back-order
condition at the vendor. VVI maintains careful records of what quantities are ordered and
what quantities are received, as well as when the bottles are ordered and when they are
received, and the actual price charged for the bottles.
In: Computer Science
note: USE C++ WITH USER DEFINED FUNCTIONS AND RECURSIVE FUNCTION ONLY. No C++ library function is allowed.
The game of “Jump It” consists of a board with n positive
integers in a row, except for the first
column, which always contains zero. These numbers represent the
cost to enter each column.
Here is a sample game board where n is 6:
0 3 80 6 57 10
The object of the game is to move from the first column to the last
column with the lowest total
cost.
The number in each column represents the cost to enter that column.
You always start the game
in the first column and have two types of moves. You can either
move to the adjacent column or
jump over the adjacent column to land two columns over. The cost of
a game is the sum of the
costs of the visited columns.
In the board shown above, there are several ways to get to the end.
Starting in the first column,
our cost so far is 0. We could jump to 80, then jump to 57, and
then move to 10 for a total cost
of 80 + 57 + 10 = 147. However, a cheaper path would be to move to
3, jump to 6, then jump to
10, for a total cost of 3 + 6 + 10 = 19.
Write a recursive function that solves this problem and returns
the lowest cost of a game board
represented and passed as an array.
Note: your function shouldn’t output the actual sequence of
jumps, only the lowest cost of this
sequence.
IMPORTANT: Use only user defined functions. No C++ library function is allowed. Please write it in a simple and elementary way.
In: Computer Science
PYTHON
In this lab we will design a menu-based program. The program will allow users to decide if they want to convert a binary number to base 10 (decimal) or convert a decimal number to base 2 (binary). It should have four functions menu(), reverse(), base2(), and base10(). Each will be outlined in detail below. A rubric will be included at the bottom of this document.
Menu()
The goal of menu() is to be the function that orchestrates the flow of the program. menu() should be the first thing called and should do the following:
Base2()
This function should take a number from the user and convert it into its binary representation then print it to the user. You can use your code from Lab1.
Base10()
This function should prompt the user for a binary number represented by a string and calculate the decimal number. Base10() should do the following:
for i in range(0,len(st)):
sum+=(int(st[i])*(2**i))
print(sum)
Remember that len returns the number of characters in a string and we can access a character by using the string name and an index number. st[0] would return the first character of the string in variable st. If we think about the conversion, we take the number and multiple by 2 raised to the power of the position number. If we reverse the string, we can use the index number as this position number because the string is indexed left-to-right. Which is the opposite of number positions are right-to-left. Thus, I can be used as our exponent.
Reverse()
#Name: Reverse
#Input: String s
#Output: String r
#Description: This function takes a string as input and reverses that string
#returning it as output.
def reverse(s):
r=""
for i in s:
r=i+r
return r
20 pts. |
The Menu() function achieves the goals given above. |
20 pts. |
Base2() takes in an int from the user and accurately converts it to binary |
20 pts. |
Base10() takes in and accurately converts a binary number to a decimal. The binary number is entered by the user. |
20 pts. |
Reverse() is implemented and called correctly. |
20 pts. |
Comments-There should be a comment block at the top that contains:
There should also be a comment before each function explaining
See reverse above. |
In: Computer Science
In: Computer Science
Make 2 hard programming (1 about pattern and 1 about anything) problem in c++ that can be solved in around 30 minute
give the problem + the answer please
i need for learning c++
In: Computer Science
Write a SuffixArray client that, given a string and an
integer L, finds all repeated substrings of length L or
more.(Please give solution in java)
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.
This means that you should not use arrays, lists,
arraylists,
linked lists, sets, maps, trees, or any other multi-element
data structure.
Instead, your 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:
|
Example:
Input File Output File Contents Contents 1 1 3 3 3 60 3 75 60 80 60 100 75 130 75 140 75 985 80 1000 80 100 130 140 985 985 985 1000 |
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
In: Computer Science
Propose two strategies that can be implemented in BCP to reduce the down time and improve the resistance of IT infrastructure
In: Computer Science
A company needs calculating the total working time of
employees in a team. You are going to help to write a program that
totals the working time in hours and minutes. You
should name your program as workingTime.py.
Your program should first ask the user how many employees there are
on the team. You may assume the value entered will not be negative,
but it could be zero. Your program will now be controlled by a loop
that asks for, and adds, the hours and minutes for each employee.
Of course the minutes will frequently add up to more than an hour,
but you should not report a total time such as 24 hours 77 minutes
for example (or worse, 18 hours 377 minutes). Instead you should
report the total time as 25 hours 17 minutes . On the other hand,
if the total number of hours is 24 or greater you should not report
the time in days, hours and minutes. Hours and minutes
are all that are to be reported.
While you may assume that all of the hours and minutes entered by the user will be nonnegative, a time may be entered with minutes that exceed 60. Your program should be able to handle this and still report the total correctly. For example, 5 hours, 65 minutes and 3 hours, 88 minutes should add up to 10 hours, 33 minutes. Consequently for a given team we should see output such as:
Total time: 29 hours 18 minutes
Note: 1. The number 29 and 18
is calculated based on the user’s input.
2. If you already know about conditionals, you may not use them in
this program.
In part II, the company needs to calculate the total working time for employees from all teams in days, hours, and minutes. Users of the program report that they do not like having to start the program over and over to process multiple teams, so we are going to fix that complaint.
Add code to first ask how many teams are to be processed (you may assume the value entered is non-negative). Use this number to determine how many times the program will go through one loop (known as an outer loop) that contains within it the code from part 1. Since the loop from the code of part 1 will now lie within the loop you are developing for this part of the assignment, it is known as the inner loop. At the end of each pass of the outer loop your program should identify the team being processed as Team1, Team2, etc. and then report the total time of that Team. Thus we may see output such as:
Team1 Total time: 29 hours 18 minutes
Team2 Total time: 27 hours 49 minutes
Team3 Total time: 15 hours 1 minutes
Finally, add code to output the total time of all of the teams entered. Thus, the last line of output may be: Total time of all teams: 3 days 0 hours 8 minutes Note that the total time for all teams should display the number of days, hours, and minutes.
If you already know about conditionals, you may not use them in this program.
In: Computer Science