EXCEL VBA
Total Net Purchase is the running
total of Net Purchases
Create a user interface form as shown below. Use text boxes to
input price and quantity. Use labels to display the discount, net
purchase (purchase amount after discount) and total net purchases.
Click calculate button to calculate and display discount, net
purchase, and total net purchases; click clear button to clear
values from the text boxes and labels, except total net purchases;
send the focus to the price text box.
Click exit button to end the application.
State Capital
MN St.Paul
WI Madison
TX Austin
In: Computer Science
In: Computer Science
Q18.
// This program finds the average time spent programming by a student // each day over a three day period. // PLACE YOUR NAME HERE #include using namespace std; int main() { int numStudents; float numHours, total, average; int student, day = 0; // these are the counters for the loops cout << "This program will find the average number of hours a day" << " that a student spent programming over a long weekend\n\n"; cout << "How many students are there ?" << endl << endl; cin >> numStudents; for (student = 1; student <= numStudents; student++) { total = 0; for (day = 1; day <= 3; day++) { cout << "Please enter the number of hours worked by student " << student << " on day " << day << "." << endl; cin >> numHours; total = total + numHours; } average = total / 3; cout << endl; cout << "The average number of hours per day spent programming by " << "student " << student << " is " << average << endl << endl << endl; } return 0; }
Note that the inner loop of this program is always executed exactly three times—once for each day of the long weekend. Modify the code so that the inner loop iterates n times, where n is a positive integer input by the user. In other words, let the user decide how many days to consider just as they choose how many students to consider.
Sample Run:
This program will find the average number of hours a day that a student spent programming over a long weekend How many students are there? 2 Enter the number of days in the long weekend 2 Please enter the number of hours worked by student 1 on day 1 4 Please enter the number of hours worked by student 1 on day 2 6 The average number of hours per day spent programming by student 1 is 5 Please enter the number of hours worked by student 2 on day 1 9 Please enter the number of hours worked by student 2 on day 2 13 The average number of hours per day spent programming by student 2 is 11
Q19. Modify the program from Q18 so that it also finds the average number of hours per day that a given student studies biology as well as programming. For each given student include two prompts, one for each subject. Have the program print out which subject the student, on average, spent the most time on.
In: Computer Science
Take into account robotic space exploration. Please describe why an engineer would decide to use C or C++ over a higher level language such as Python? What are some benefit an object-oriented language have in comparison to a purely procedural language?
In: Computer Science
Q20. Using C++ style string to write a program that reads a sentence as input and converts each word of the sentence following the rule below:
More requirements:
More assumptions:
Sample Run:
Please enter the original sentence: i LOVE to program Translated: IKPU OVELKPU OTKPU ROGRAMPKPU
In: Computer Science
You are hired to design a database for a fitness center. As the fitness center is expanding with more than one branch, they want to create a database to keep track of its customers, facilities and employees. Each branch has a unique id and address (building number, street, district, and city). A branch may have more than one facility (e.g. swimming pool, spa, etc.). Each facility must belong to only one branch, and the information for a facility is name and fees. In addition, each fitness branch offers different classes (such as Yoga, Pilates, Zumba, etc.). All classes should be led by at most one trainer, who is an employee.
Employees must work at one and only one branch. Each employee has an id, name, address (building number, street, district, and city) and can have multiple phone numbers. An employee can only be an admin, managing the facility or working as a clerk, or a trainer. An employee cannot be a trainer and an admin because the trainer id compensated an hourly wage while an admin staff paid a monthly salary. Trainers can train individual customers at different time sessions.
A customer must register at one branch. Each customer has a membership number, name (stored as first name and last name), email, and only one phone number. A customer can join more than one class or uses any number of facilities. A customer may also decide to be trained by at most one personal trainer.
Given the above description:
1. Draw a Chen's Notation ER Diagram for the database, identifying the following:
a.All the entities, attributes and relationships
b.Primary key and (discriminator in weak entity, if any). Don’t forget each entity has to have PK.
c.Participation and cardinality constraints. (Explain your choices for two constraints- i.e. identify the words the guided your decision)
d.Specialization and completeness constraints (if there is an ISA relationship).
2. Write a schema for two entities and two relationships of your choice. Remember, sometimes a relationship is better not be represented in a separate schema; if this is the case with your chosen relationship explain what you will do.
In: Computer Science
A multiple-choice examination consists of 20 questions. Each
question has five choices, labeled A, B, C, D and E. All data for
that exam is stored in a file exam.txt. The first line of data
contains the correct answers to the twenty questions in the first
20 consecutive (one after the other) character positions.
For Example: BECDCBAADEBACBEDDBED
Each subsequent line in the file contains the answers for a single
candidate. Data on a line consists of a candidate number (an
integer), then by one or more spaces, followed by the twenty
answers given by the candidate in the next 20 consecutive character
positions. An X is used if a candidate did not answer a particular
question. A sample line is as follows:
5555 BECDCXACCAEDCBEDDACB
There can be an unlimited number of candidates. A line containing a
“candidate number” 0 indicates the end of the data.
A student’s final score is calculated by adding up the points
awarded for all the questions. Points for a question are awarded as
follows:
• Correct answer 4 points
• Wrong answer -1 point
• No answer 0 points
Write a C# program to process the data in the file exam.txt and
generate a report that shows:
1. Each candidate number and their final score (the total points
obtained by the candidate).
2. The total number of candidates.
3. The number of correct responses to each of the 20
questions.
4. The minimum score attained by a student in the exam.
5. The maximum score attained by a student in the exam.
6. The average score attained by a student in the exam.
The report must be written to a file called Report.txt.
In: Computer Science
Write an Assembley Language.Given a number x, determine whether the given number is Armstrong number or not. A positive integer of n digits is called an Armstrong number of order n(where order is the number of digits) if.
abcd... = pow(a,n) + pow(b,n) + pow(c,n) + pow(d,n) + ....
Example:
HINT: Use the ReadString function found in the Irvine32 library to capture the user's input.
In: Computer Science
Your (turtle) program in python must include: Create four Red turtles and four Blue turtles using one or more lists. • Start each of the Red turtles at a different random location on the left side of the screen within the range of the square formed by (-100, 100) and (0, -100) and each of the Blue turtles at a random location on the right side of the screen within the range of the square formed by (0, 100) and (100, -100). • Each of the red and blue turtles should move randomly. • Draw a boundary for the game as a circle with a 300 unit radius. You will use an invisible turtle to do this. It does not count as one of the turtles on either team. • If a turtle hits the border the turtle should have its color changed to black and should jump back to the center of the screen (0, 0) and continue moving. • All the turtles will move the same speed. • The turtles should continue moving until 1000 time units have elapsed.
In: Computer Science
Python please Questions #3, #4 and # 5 please
A string is one of most powerful data types in programming. A string object is a sequence of characters and because it is a sequence, it is indexable, using index numbers starting with 0. Similar to a list object, a string object allows for the use of negative index with -1 representing the index of the last character in the sequence. Accessing a string object with an invalid index will result in IndexError exception.
In Python a string literal is defined to be a sequence of characters enclosed in single, double or triple quotes.
To define a string object or variable, we use one of the following:
A string object in immutable, meaning, it cannot be changed once it is defined.
The concatenation operator (+) is used to add two or more string objects (strObj1 + strObj2)
The repetition operator (*) is used to repeat the string object (n*strObj or strObj*n, where n is an integer)
The in and not in operators are used to test if one string object is contained in another string object.
Slice a string object using strObj[start:end], start is the index of the starting character and end-1 is the index last character.
The split method creates a list of the split string object.
lstObj = strObj.split(split-character)
space is the default split-character.
The strip method removes the leading and trailing character, the default is space.
strObj.strip(strip-character)
Variations: rstrip, lstrip (left and right strip methods to remove leading and trailing character, respectively)
Other commonly used string methods are
strObj.lower() changes all characters to lowercase
strObj.upper() changes all characters to uppercase
strObj.islower() tests if all characters are lowercase
strObj.isupper() tests if all characters are uppercase
strObj.replace(old, new) replaces old substring with new substring
strObj.find(substring) returns the lowest index of the substring if it is found in strObj
Activity
In: Computer Science
Create a new folder called CSCI130_A3_yourname. Create all of the files indicated below within this folder.
For this assignment you will be creating a total of 2 classes that meet the definitions below. This assignment will allow the user to enter in the coefficients for a polynomial function of degree 2. The user will then be asked to enter a number. The program will use that number as an argument to the function, and will print the corresponding function value.
Keep in mind that a second degree polynomial function in general form looks like:
f(x) = ax2 + bx + c (here 'a' is the coefficient of the quadratic term, 'b' is the coefficient of the linear term, and 'c' is the constant)
Refer to the image at the bottom of this page to get a better understanding of the logic flow.
CLASSES:
CLASS DEFINITIONS:
class Polynomial
Data (instance variables) - all have private access
Methods (behaviors) - all have public access
constructor:
constructPolynomial:
functionValue:
displaySelf:
class Assignment3
Methods
public static void main(String[] args):
After writing the code, do the following:
In: Computer Science
KNAPSACK Optimization Problem using Greedy
Method
Problem 1:
Item Weight Value
1 14 20
2 6 16
3 10 8
4 5 10
5 4 12
Allowed weight = 24 Kg
Problem 2:
Item Weight Value
1 6 30
2 8 40
3 15 45
4 22 88
5 25 80
Allowed weight = 60 Kg
Problem 3:
Item Weight Value
1 6 30
2 8 40
3 15 45
4 22 88
5 25 80
Allowed weight = 60 Kg
In: Computer Science
We continue from the two tables in lab 3 part 2, and practice with functions and the GROUP BY statement. The data in each table should be as below
Table Product:
PROD_ID |
PROD_NAME |
PROD_PRICE |
PROD_VENDOR |
1101 |
Table |
100 |
2 |
1102 |
Chair |
80 |
3 |
1103 |
Armchair |
90 |
2 |
1104 |
Nightstand |
110 |
1 |
1105 |
Bed |
200 |
3 |
1106 |
Dresser |
150 |
3 |
1107 |
Daybed |
190 |
2 |
1108 |
Ash Table |
120 |
2 |
1109 |
Cherry Table |
130 |
2 |
1110 |
Table - High |
100 |
2 |
1111 |
Office Chair |
110 |
3 |
Table Vendor:
VEND_ID |
VEND_NAME |
VEND_ST |
1 |
Green Way Inc |
GA |
2 |
Forrest LLC |
NC |
3 |
AmeriMart |
NC |
Please write the SQL script and provide screenshots of results for these below queries. Please include the SQL in text format, and all screenshots in one single document.
Help:
I do it the following way, but it gives me an error " NO ROWS SELECTED." Also, I had to group by V.VEND_NAME, P.PROD_VENDOR, otherwise I'll get an error message. Please help me figure this out. Same for # 5. Thanks.
select P.PROD_VENDOR, V.VEND_NAME, avg(P.PROD_PRICE) as AVG_PRICE from
PRODUCT P join Vendor V on P.PROD_VENDOR = V.VEND_ID group by V.VEND_NAME, P.PROD_VENDOR;
In: Computer Science
using 8 bits and 2s complement integer arithmetic, show how a processor would calculate 63 - 17
In: Computer Science
For this question, you are given a negotiated statement of requirements and asked to produce a structural model.
Here is the negotiated statement of requirements (NSR) for the PickMeNow System (PMNS):
PickMeNow is a new taxi company which has started its operations recently. In order to meet the on-demand transportation needs of its customers, PickMeNow has decided to invest in an IT solution to connect its customers and drivers.
Drivers and customers are required to register with PickMeNow by providing a name, contact number and an email address. PickMeNow assigns an identification number to each registered driver and customer. In addition, each driver is required to provide the details of his bank account (account number and bank name) and vehicle details as described below. Drivers can transfer the amount in his PickMeNow account to his bank account.
PickMeNow provides three types of vehicle to its customers: cars, vans and mini buses. For each vehicle, it is required to capture its licence plate number, brand and model. When a customer makes a booking for a mini bus, he has to make an upfront deposit amount. The deposit will be returned to the customer if the booking is not cancelled by the customer. For vans, there is a booking fee on top of the trip fare. If a customer cancels a booking for a mini bus, the deposit is forfeited if the cancellation is received 3 days before the date of the ride.
When a customer submits a booking to PickMeNow, he needs to specify the date and time, vehicle type, the pick-up point and destination of the trip. PickMeNow would generate a booking id, calculate the fare and broadcast this trip to all available drivers who are free to accept the booking. The customer would then choose a driver from the list of drivers who had accepted the booking. The chosen driver would then proceed to provide the taxi service to the customer.
The data to be kept for each ride includes a reference number, driver and customer details (identification number and name), fare, pick-up point, destination, distance, date, start time and end time of the ride. At the end of each ride, the driver’s account will be credited with the amount of the fare minus any fee due to PickMeNow.
After completing a ride, customers can accumulate points. After completing rides worth a total of $400, the customer will become a Premium customer. Only Premium customers can redeem their points to pay their bill. Points may be used to offset a customer’s bill and if there are insufficient points, the rest of the bill must be paid using a credit card.
Develop a structural model for the system design, by submitting your answers to the following:
(a) Identify the classes, their attributes and any hierarchical
relationship(s), omitting the foreign key associations that would
be required for the application. Submit the class description as
your answer.
(b) Appraise the associations among the classes and hierarchical
relationship(s) that would be required for the application.
Construct the class-association diagram in UML as your answer. Any
derived association should be labelled, but you need not give the
derivation.
In: Computer Science