Write a C program to calculate the number of fence panels needed over a given distance. The fence must be created using two difference size panels which have a 2 foot length difference between them (ie. panels could be 2’ and 4’ or 3’ and 5’ or 5’and 7’). Your program should request the total length of the fence and the smaller panel's size. Your program will then calculate the length of the larger panel and output the number of each size panel necessary for the given length of fence. If there is a length of fence that is different from the two panel sizes, you should consider that to be a special size panel that is necessary to complete the length of fence. Output the length of that special panel. The examples below show different inputs and the expected outputs.
Here is an example of running your program with different
inputs.
NOTE: Bold text represents input that someone will type
into your program.
Measurement of the fencing needed (feet): 50 Enter the size of smaller panel in feet: 3 The larger panel will be 5 feet. Happy Building!! The fence will need 6 qty 3 foot panel(s) and 6 qty 5 foot panel(s). Plus a special order 2 foot panel. ----------------------------------- Measurement of the fencing needed (feet): 50 Enter the size of smaller panel in feet: 4 The larger panel will be 6 feet. Happy Building!! The fence will need 5 qty 4 foot panel(s) and 5 qty 6 foot panel(s). ----------------------------------- Measurement of the fencing needed (feet): 2 Enter the size of smaller panel in feet: 1 The larger panel will be 3 feet. Happy Building!! The fence will need 2 qty 1 foot panel(s) and 0 qty 3 foot panel(s). ----------------------------------- Measurement of the fencing needed (feet): 52 Enter the size of smaller panel in feet: 3 The larger panel will be 5 feet. Happy Building!! The fence will need 7 qty 3 foot panel(s) and 6 qty 5 foot panel(s). Plus a special order 2 foot panel. ----------------------------------- Measurement of the fencing needed (feet): 0 Please enter an integer > 0: 54 Enter the size of smaller panel in feet: -34 Please enter an integer > 0: 4 The larger panel will be 6 feet. Happy Building!! The fence will need 6 qty 4 foot panel(s) and 5 qty 6 foot panel(s). |
In: Computer Science
1.)recursive merge sort on a list.(Python)
2.)recursive bubble sort using a list without enumerate() function.(python)
Show Base case, and recursive case.
In: Computer Science
the following has differing roles within a large IT
department in the development of a new computer system. define
these roles and responsibilities;
1. project manager
2. technical manager
3. database administrator
In: Computer Science
In: Computer Science
Simple Java class.
Create a class Sportscar that inherits from the Car class includes the following:
a variable roof that holds type of roof (ex: convertible, hard-top,softtop)
a variable doors that holds the car's number of doors(ex: 2,4)
implement the changespeed method to add 20 to the speed each time its called
add exception handling to the changespeed method to keep soeed under 65
implement the sound method to print "brooom" to the screen.
create one constructor that accepts the car's roof,doors, year, and make as arguments and assigns the values appropriately. do not create any other constructors.
the interface methods should print messages using system.out.println()
car class:
abstract clas Car implements Vehicle(
private int year;
private int speed;
private string make;
private static int count=0;
public car(int year, string amake){
year = aYaer;
make = aMake;
speed =0;
count++;}
public void sound();
public static int getcount90{
return count;}
}
In: Computer Science
In: Computer Science
What is the exact output of the following pseudocode segment?
METHOD MAIN
CALL myMethod (0,2)
CALL myMethod (3,5)
CALL myMethod (6,7)
END MAIN
|
Answer: |
METHOD myMethod(A,B)
BEGIN
WHILE (A < B)
PRINT(A + "
")
A ← A + 1
ENDWHILE
PRINTLINE();
END MyMethod
In: Computer Science
Why the recursion in Pascal's Triangle is also the recursion for counting sub-sets.
In: Computer Science
I need this in PSEUDOCODE:
Write a method, called PrintNumbers, that prints out the following sequence of numbers. The method must use a for-loop to print the outputs. HINT: “To get started: what’s the pattern from number X to (X+1)? Does it apply to the next pair of numbers?” 8 12 18 26 36 48 62
In: Computer Science
In python please
6.12 Mortgage Example
A mortgage company is interested in automating their decision-making process.
As part of this automation, they are looking for a software that takes a set of information from each customer and identify
1) if a customer is eligible to apply for a mortgage
2) if a customer is qualified to get the mortgage of the requested amount,
eligibility criteria:
1. the applicant should be 19 or over 19 years old
2. the applicant should be the resident of that country (in the beginning assume that the applicant needs to be a resident of U.S.)
qualification criteria
1. the applicant should be eligible
2. the difference between the applicant's monthly income and applicant's monthly expenses should be greater than the mortgage monthly payments
Considering the code in the template, complete the code so that it prints; 1) if the user is eligible 2) the amount of monthly mortgage payment for the requested amount of mortgage with a specific interest rate taken from input and specific amount of time (in years) to pay off the mortgage, and 3) if the used is qualified
Hint: use this formula to calculate the monthly mortgage payment: (RequestedMortgageAmount + (RequestedMortgageAmount * overallinterestrate)) / (years * 12)
please consider 15%, 20% and 24% overall interest rate for pay offs in 10, 15, and 30 years, respectively. Round down the monthly mortgage payment using int() function.
Fix the mortgagemonthlypayment function and then call it in the main program with appropriate inputs.
Given code:
# we define four functions; eligible(),
difference_btw_incomeAndexpense(), mortgae_monthly_payment() and
qualify()
# reminder: each function is like a template and it does not run
unless we call it with appropriate set of input values
# This function takes applicant's age and country of residence
and return a boolean variable;if True meaning that the applicant is
eligible
def eligible(age, country_of_residence):
elig = False
if (age >= 19) and (country_of_residence == 'USA'):
elig = True
return elig
# This function takes the family income value and all expenses and
calculate the difference btw them and return the difference
def difference_btw_incomeAndexpense(family_income, loan_payments,
educations_payment, groceryAndfood, others):
diff = family_income - (loan_payments + educations_payment +
groceryAndfood + others)
return diff
# This function takes the user requested amount of mortgage and
applies an interest rate to it and calculates the monthly payment
amount
# This function applies 20% overall interest rate over 15
years
# you can make changes to this function and make it closer to what
happens in reality. How ????????????????????
#def mortgage_monthly_payment(RequestedMortgageAmount):
# m_p = (RequestedMortgageAmount + (RequestedMortgageAmount * 0.2))
/ (15 * 12)
# return m_p
def mortgage_monthly_payment(RequestedMortgageAmount,
years):
#### FIX ME
# This function takes the output of the last two function and
the amount of mortgage monthly payments and return if the applicant
is qualified or not
def qualify(elig, diff, mortgage_monthly_payment):
qual = False
if (elig == True) and (diff > mortgage_monthly_payment):
qual = True
return qual
# the main program
# sometimes, we write a function and we want to use that in
other Python scripts as a module.
# In this example, we want to use all three functions in the
current program (script)
# the following if statement is used to tell Python that we want to
use the above-defined functions in the current Python script.
if __name__ == "__main__":
print('please enter your age:')
age = int(input())
print('Please enter the country of residence. If you are a resident
of the United States enter USA:')
country = input()
family_income = int(input('Please enter your family total monthly
income:'))
loan_payment = int(input('Please enter your family amount of
monthly loan payment:'))
edu = int(input('Please enter an estimate of your family amount of
monthly education payment:'))
groceryAndfood = int(input('Please enter your family amount of
monthly grocery and food expenses:'))
others = int(input('Please enter the amount of other expenses not
listed above:'))
requested_mortgage_amount = int(input('Please enter the amount of
the mortgage you arerequesting:'))
####### COOMPLETE ME
# we call eligible() function
# we keep the result of eligible() function in variable E and then
test E using a conditional statement to print eligible or not
eligible
E = eligible(age, country)
if E == True:
print('you are eligible')
else:
print('you are not eligible')
# calling difference_btw_incomeAndexpense() function and keeping
its outcome in Difference variable so that we can use it later on
when we call qualify() function
Difference = difference_btw_incomeAndexpense(family_income,
loan_payment, edu, groceryAndfood, others)
# calling mortgage_monthly_paymenr() function and keeping its
outcome in Mortgage_m_p variable to be used in qualify() function
later on
# fixme
# calling qualify() function using the outputs of eligible(), E,
the output of diff(), Difference, and the output of
mortgage_monthly_payment(), Mortgae_m_p
Qual = qualify(E, Difference, Mortgage_m_p)
# since Qual is either True or Fasle, we want to use it to print
a stetement to tell the user if they are qualified or not
if Qual == True:
print('you are qualified')
else:
print('you are not qualified')
In: Computer Science
You were hired as the manager for network services at a medium-sized firm. This firm has 3 offices in 3 American cities. Recently, the firm upgraded its network environment to an infrastructure that supports converged solutions. The infrastructure now delivers voice, data, video, and wireless solutions. Upon assuming the role of network manager, you started reviewing the documentation and policies in place for the environment to ensure that everything is in place for the upcoming audit. You notice that a formal network security policy is nonexistent. You need one. The current network environment and services are as follows:
Considering the network environment, services, and solutions that are supported, develop a network security policy of 3–4 pages for the environment, including the following:
In: Computer Science
Note: There is no database to test against
| WorkerId | Number(4) | Not Null [PK] |
| WorkerName | Varchar2(20) | |
| CreatedDate | DATE | |
| CreatedBy | Varchar2(20) |
Create a stored procedure (SP) called Add_Worker that will add an employee to a factory. This SP has two parameters:
a) A parameter (WorkerId) that the SP can read or write to. When the procedure is called it will contain the PK value that should be used to add the row.
b) A parameter (WorkerName) that the SP can read only, it contains the new worker's username.
c) A parameter (Result) that the SP can write to. If the new record is added successfully, the parameter will be set to the value 'Entered Successfully'. If the add fails the parameter is set to the value 'Unsuccessful'.
Declare an exception named WORKER_NOT_ADDED. Associate the number -20444 with this exception.
Execute an insert statement to add the row to the table. Use the values of the passed parameters on the insert statement. Today's date should be used for the Created_date column. Use 'abcuser' for the CreatedBy column.
If the workerID is added:
a) Set the parameter 'Result' to 'Entered Successfully'
b) Commit the changes
Next, add exception processing to the SP
a) For all exceptions, set the parameter 'Result' to 'Unsuccessful'
b) If the WORKER_NOT_ADDED exception occurs, display the message 'New WorkerId already exists on the table.'
c_ For any other error, display the error number and the message associated with that error number.
In: Computer Science
Run the following code. Discuss the output result, i.e. the value of seq variable.
#include <stdio.h>
#include <unistd.h>
int main()
{ int seq = 0; if(fork()==0) { printf("Child! Seq=%d\n", ++seq); }
else { printf("Parent! Seq=%d\n", ++seq);
} printf("Both! Seq=%d\n", ++seq); return 0; }
In: Computer Science
If answer can be shown using a c++ program and leave comments it will be very appreciated!!!
A bank charges $10 per month plus the following check fees for a commercial checking account: $0.10 each for fewer than 20 checks $0.08 each for 20-39 checks $0.06 each for 40-59 checks $0.04 each for 60 or more checks The bank also charges an extra $15.00 if the balance of the account falls below $400 (before any check fees are applied). Write a program that asks for the beginning balance and the number of check written. Compute and display the bank's service fees for the month. Input Validation: Do not accept a negative value for the number of checks written. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn.
Beginning balance: $-100 Number of checks written: 30 Your account is overdrawn! The bank fee this month is $27.40
Beginning balance: $400.00 Number of checks written: -20 Number of checks must be zero or more.
Beginning balance: $300.00 Number of checks written: 36 The bank fee this month is $27.88
Beginning balance: $300.00 Number of checks written: 47 The bank fee this month is $27.82
Beginning balance: $350.00 Number of checks written: 5 The bank fee this month is $25.50
Beginning balance: $300.00 Number of checks written: 70 The bank fee this month is $27.80
In: Computer Science
Program 1: Stay on the Screen! Animation in video games is just like animation in movies – it’s drawn image by image (called “frames”). Before the game can draw a frame, it needs to update the position of the objects based on their velocities (among other things). To do that is relatively simple: add the velocity to the position of the object each frame. For this program, imagine we want to track an object and detect if it goes off the left or right side of the screen (that is, it’s X position is less than 0 and greater than the width of the screen, say, 100). Write a program that asks the user for the starting X and Y position of the object as well as the starting X and Y velocity, then prints out its position each frame until the object moves off of the screen. Design (pseudocode) for this program
Sample run 1:
Enter the starting X position: 50
Enter the starting Y position: 50
Enter the starting X velocity: 4.7
Enter the starting Y velocity: 2
X:50 Y:50
X:54.7 Y:52
X:59.4 Y:54
X:64.1 Y:56
X:68.8 Y:58
X:73.5 Y:60
X:78.2 Y:62
X:82.9 Y:64
X:87.6 Y:66
X:92.3 Y:68
X:97 Y:70
X:101.7 Y:72
In: Computer Science