NEED ASAP PLEASE IF THIS CANNOT BE ANSWERED WITHIN 1 HOUR TO 1.5 HOURS MAX PLEASE DO NOT DO
I DON'T NEED PROBLEMS 1-4 PLEASE ANSWER 5-7 ONLY. ONLY LISTED 1-4 AS A REFERENCE.
This should be in
Type of application :Console application
Language used :C#
Program.cs :
Problem 1:
(15 pts)
Write a C# console program that continually asks the user "Do you want
to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters
either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and
then get keyboard input of the name. After entering the name, display the name to the screen.
Problem 2:
(20 pts) Create a Patient class which has private fields for patientid, lastname,
firstname, age, and email. Create public properties for each of these private fields with get and
set methods. The entire lastname must be stored in uppercase. Create a main class which
instantiates a patient object and sets values for each data item within the class. Display the
data in the object to the console window.
Problem 3:
(15 pts) Modify the Patient class with two overloaded constructors: A new default
constructor which initializes the data items for a patient object using code within the
constructor (use any data). A second constructor with parameters to pass all the data items
into the object at the time of instantiation. Create a test main class which instantiates two
objects. Instantiate the first object using the default constructor and the second object using
the constructor with the parameters.
Problem 4:
(10 pts) Add a static display method in the main class in the patient application
that has a parameter to pass a patient object and display its content.
Problem 5:
(10 pts) Modify the patient class with two overloaded methods to display a bill for a
standard visit based on age. In the first method do not use any parameters to pass in data. If
the patient is over 65, then a standard visit is $75. If the patient is under 65, then the standard
doctors office visit is $125. Build a second method where you pass in a discount rate. If the
patient is over 65, then apply the discount rate to a standard rate of $125. Create a main
method that calls both of these methods and displays the results.
Problem 6:
(20 pts) Create two subclasses called outpatient and inpatient which inherit from
the patient base class. The outpatient class has an additional data field called doctorOfficeID
and the inpatient class has an additional data item called hospitalID. Write a main method that
creates inpatient and outpatient objects. Sets data for these objects and display the data.
Problem 7:
( 10 pts) Modify the base class of Problem 6 to be an abstract class with an abstract
display method called displayPatient that does not implement any code. Create specific
implementations for this method in both the outpatient and inpatient subclasses.
In: Computer Science
You are developing an application that prints out invoice information of customers and cars from dealers. The invoice contains: dealer name, customer name, customer’s phone number, car maker, building year, and total price. Please follow below instructions to write a program.
Part 1 create data types
1. Create an enumerated data type that holds 7 car colors, which are: red, black, white, blue, yellow, gray, and silver;
2. Create a structure for car that holds 4 members: car maker, building year, car color, and total price;
3. Create another structure for customer that holds 2 members: customer name, and customer phone number;
4. Create a third structure for invoice that holds 3 members: dealer name, customer information and car information. The car information is a pointer.
Part 2 define functions
1. Define a function that returns price rate base on the car color. If the car’s color is red, black or white, then the rate is 1. If the color is blue or yellow, then the rate is 1.5. If the color is gray or silver, then the rate is 2;
2. Define a function that copy each member in an invoice variable (e.g., var1) and assign these members to another invoice variable (e.g., var2). Then return this copied invoice variable (var2);
3. Define a function that display invoice information, which includes:
• Dealer name
• Customer name
• Customer phone number
• Car maker
• Car building year
• Car total price
Part 3 manipulate data
A car inventory of cars contains information of three cars: 2018 white Honda, 2019 blue BMW, 2018 silver Tesla. The initial price of each car starts at the price of $30,000. The color base price is $300, and it is varied by multiplying the price rate.
1. Define three pointers that hold char array values for car maker: Honda, BMW, Tesla;
2. Define a C++ string array that holds values of model year;
3. Define a pointer of the car’s type (car pointer) and dynamic allocate an array of size 3;
4. Define a pointer (price pointer) that dynamic allocate an array of size 3. The values pointed by the price pointer and its offsets are total price for each car;
5. Base on color information and price rate, calculate total prices and store them into price pointer and its offsets: total price = initial price + (color base price * price rate);
6. According to above information, store makers, model years, car color, and total price to the car array that pointed by car pointer.
A customer named Tom Smith comes to Carfax to buy the 2019 blue BMW. His phone number I (408)123-4567.
1. Create a variable of invoice type (invoice variable) and store dealer, customer, and car information;
2. Call the display function to print out invoice information.
Later, Tom Smith goes to KBB and buy the 2018 silver Tesla.
1. Create another variable of invoice type (copied invoice variable) and copy contents from invoice variable;
2. Modify contents in copied invoice variable to match the second transaction information;
3. Call the display function to print out this invoice information.
In: Computer Science
C++ program which partitions n positive integers into two disjoint sets with the same sum. Consider all possible subsets of the input numbers.
All in one C++ file.
This is the sample Input 1
6 3 5 20 7 1 14
Output 1
Equal Set: 1 3 7 14
This is the sample Input 2
5 10 8 6 4 2
Output 2
Equal Set: 0
In: Computer Science
Case Study 1: Recent attacks
Case Study 2: Crypto-malware Attacks
Use the Internet to research some of the recent different crypto-malware ransomware attacks.
In: Computer Science
Sun Mon
Tue Wed
Thu
Fri Sat
1 2
3
4
5
6
7
8 9
10 11
12
13
14
15
16
17 18
19
20
21
22
23
24 25
26
27
28
29
30
In: Computer Science
Write an evenTest(n) function that returns True if it is given
an even integer and False if it is given an odd number. The rest of
your code (outside of the function) should get an integer number
from the user, call evenTest(n) to test if the number is even, and
then tell the user if the number was even or odd. Name the program
even_or_odd.py.
Part 2. Salary.py (5 pts) You are offered two options to receive
salary: • Option 1: Constant Salary: Receive $100 each day for 10
days • Option 2: Doubling Salary: $1 the first day, $2 the second
day, $4 the third day, $8 the fourth day, doubling the amount each
day, for 10 days. Define a function constant_salary() that computes
and returns the total income for Option 1. Define a function
doubling_salary() that computes and returns the total income for
Option 2. The rest of your code (outside of the functions) should
call both functions, compare the totals they return, and determine
which salary option pays more. This program does not ask the user
for any input. Name the program salary.py.
In: Computer Science
Design and develop a class named Person in Python that contains two data attributes that stores the first name and last name of a person and appropriate accessor and mutator methods. Implement a method named __repr__ that outputs the details of a person.
Then Design and develop a class named Student that is derived from
Person, the __init__ for which should receive first name and last
name from the class Person and also assigns values to student id,
course, and teacher name. This class needs to redefine the __repr__
method to person details as well as details of a student. Include
appropriate __init__.
Design and develop a class named Teacher that is derived from Person. This class should contain data attributes for the course name and salary. Include appropriate __init__. Finally, redefine the __repr__ method to include all teacher information in the printout.
Implement an application/driver that creates at least two student
objects and two teacher objects with different values and calls
__repr__ for each.
In: Computer Science
JAVA LANGUAGE
Create a new project named BankAccount in Eclipse. Then,
implement the following requirements. You need to create two
classes, one for BankAccount (BankAccount.java) and the other for
the tester (BankAccountTest.java).
Make sure your program compile without errors before submitting.
Submit .java files to eCampus by the end of next Thursday,
10/15/2020.
Part 1: Create the BankAccount class (template is attached after the project description) in the project. You must add the following to the BankAccount class:
An instance variable for bank account number: accountNum
The long getAccountNum() method to get the account number
The void setAccountNum(long acctnum) method to set the account
number
An instance variable for bank account owner’s name: name
The String getAccountName() method to get the account owner’s
name
The void setAccountName(String acctname) method to set the account
owner’s name
Another instance variable for account overdrawn status:
overdrawn
The boolean isOverdrawn() method to get the account overdrawn
status
The void setOverdrawn(boolean status) method to set the account
overdrawn status
A constructor with four parameters: name, account number, the
initial balance, and the overdrawn status to set the initial values
for the instance variables when an object is created
Modify the withdraw() and deposit() methods
An account will be overdrawn if a withdrawal results in a negative
balance.
An account that was overdrawn will not be overdrawn anymore if a
deposit results in a positive balance or 0.
The deposit and withdraw methods must verify the amount to deposit
(or to withdraw). If the amount is negative, the methods must
printout "Negative amount!" and the balance of the account will not
be changed.
Add a method called transfer(double amount, BankAccount
otherAccount)
The transfer method is to transfer some money from the account to
another account specified by otherAccount.
Add a method addInterest ( ) to add interest to the account and
change the balance
use a constant to represent the interest rate 3.5%
Add the toString() method to represent an account in the following
format:
“The Account Number xxx is owned by xxx with a Balance xxx. It is
(not) overdrawn.”
Here xxx needs to replace by the values of the account. If it is
overdrawn, show
overdrawn. Otherwise, show not overdrawn.
Part 2: Create a BankAccountTest class with only the main method in the BankAccount project to test the BankAccount class. You must add the following to the BankAccountTest class:
Create a BankAccount object named harrysChecking with the
initial values: name as "Harry", accoutNum as 12345, balance as
0.00, and overdrawn as false
Print out the object harrysChecking by calling toString()
method
Call the deposit method to deposit $200 to harrysChecking and then
print out the current balance and overdrawn status of
harrysChecking
Call the withdraw method to withdraw $500 from harrysChecking and
then print out the current balance and overdrawn status of
harrysChecking
Again call the deposit method to deposit $400 to harrysChecking and
then print out the current balance and overdrawn status of
harrysChecking
Create a BankAccount object named harrysSaving with the initial
values: name as "Harry", accoutNum as 86754, balance as 500.00, and
overdrawn as false
Print out the object harrysSaving by calling toString()
method
Call the transfer method to transfer $50 from harrysChecking to
harrysSaving
Print out the current balances of harrysChecking and harrysSaving,
respectively
Call the addInterest method to add interest to harrysSaving and
Print out information for harrysSaving by calling toString()
method
/**
A bank account has a balance that can be changed by deposits,
withdrawals, transfers, and interests.
*/
public class BankAccount {
private double balance;
/**
Constructs a bank account with a zero balance
*/
public BankAccount() {
balance=0;
}
/**
Constructs a bank account with a given balance
@param initialBalance the initial balance
*/
public BankAccount(double initialBalance) {
balance=initialBalance;
}
/**
Deposits money into the bank account.
@param amount the amount to deposit
*/
public void deposit (double amount) {
balance=balance+amount;
}
/**
Withdraws money from the bank account.
@param amount the amount to withdraw.
*/
public void withdraw (double amount) {
balance=balance-amount;
}
/**
Gets the current balance of the bank account.
@return the current balance
*/
public double getBalance() {
return balance;
}
}
public class BankAccountTest {
public static void main(String[] args) {
}
}
In: Computer Science
Do Programming Exercise 1 (Bug collector) - Page 203 (Page 180 is good inspiration: Output should look like this... Enter the number of bugs collected today on day 1 : 10 Enter the number of bugs collected today on day 2 : 5 Enter the number of bugs collected today on day 3 : 20 Enter the number of bugs collected today on day 4 : 0 Enter the number of bugs collected today on day 5 : 40 Total bugs collected: 75
In: Computer Science
Create a class called FileSumWrapper with a method that has the signature public static void handle(String filename, int lowerBound).
Make this method call FileSum.read and make your method catch all the errors.
FileSum.read is a method that takes a filename and a lower bound, then sums up all the numbers in that file that are equal to or above the given lower bound.
I'm unsure at how to incorporate the FileSum.read() method to even start anything. I also don't know what the whole "lower bound" means or is suppose to do. Please attach comments/notes as to why something is there/ how it works. I'm also not very great on how to import files. Thank you if you can help even just a bit.
Given:
FileSum.java
import java.io.File; import java.rmi.UnexpectedException; import java.util.Scanner; public class FileSum { public static int read(String filename, int lowerBound) throws Exception { Scanner inputFile = new Scanner(new File(filename)); int acc = 0; boolean atLeastOneFound = false; while (inputFile.hasNext()) { int data = inputFile.nextInt(); if (data >= lowerBound) { acc += data; atLeastOneFound = true; } } if (!atLeastOneFound) { throw new UnexpectedException(""); } return acc; } }
---------------------------------------------------------------------------------------------------------
Question1.java
import java.util.Scanner; public class Question1 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a filename"); String filename = keyboard.nextLine(); System.out.println("Enter a lower bound"); int lowerBound = keyboard.nextInt(); FileSumWrapper.handle(filename, lowerBound); } }
---------------------------------------------------------------------------------------------------------
err.txt
50 40 30 90 85 23 06 30x 54 675 875 34 2323 423 423 5 5 79 97 90y 7986 5 46 64656 66 6 333 93 9 300 20 2 9 209 290 39 48 85 7847 578048
---------------------------------------------------------------------------------------------------------
t1.txt
50 40 30 90 85 23 06 30 54 675 875 34 2323 423 423 5 5 79 97 90 7986 5 46 64656 66 6 333 93 9 300 20 2 9 209 290 39 48 85 7847 578048
---------------------------------------------------------------------------------------------------------
Input | Output |
---|---|
t1.txtENTER 50 |
Enter a filename\n Enter a lower bound\n Sum of all numbers in t1.txt is 665177\n |
Input | Output |
---|---|
t1.txtENTER 500 |
Enter a filename\n Enter a lower bound\n Sum of all numbers in t1.txt is 662410\n |
Input | Output |
---|---|
t1.txtENTER 5000000 |
Enter a filename\n Enter a lower bound\n CS112 error: Found no numbers above 5000000\n |
Input | Output |
---|---|
t1.txtENTER 6000000 |
Enter a filename\n Enter a lower bound\n CS112 error: Found no numbers above 6000000\n |
Input | Output |
---|---|
t1e.txtENTER 50 |
Enter a filename\n Enter a lower bound\n CS112 error: Couldn't open t1e.txt\n |
Input | Output |
---|---|
t11e.txtENTER 50 |
Enter a filename\n Enter a lower bound\n CS112 error: Couldn't open t11e.txt\n |
Input | Output |
---|---|
err.txtENTER 50 |
Enter a filename\n Enter a lower bound\n CS112 error: Was reading integers but found something else\n |
In: Computer Science
this code still shows that it still has an syntax error in it can you please fix it. I will put an error message next to the line that is wrong and needs fixed, other than that the other lines seems to be ok.
public static void main()
{
/**
* main method - makes this an executable program.
*/
public static void main("String[]args"); this is the error line
that I get and needs fixed
// create a client with placeholder values
system.out.println("Client with default information");
// create a client object using first constructor
Client client1 = new Client();
// Display information about the client
System.out.println(client1.toString());
System.out.println();
System.out.println("Create a client by providing
information");
// client last name - Jameson
// client first name - Rebecca
// client age - 32
// client height - 65
// client weight - 130
Client client2 = new Client("Jameson", "Rebecca",
32, 65, 130);
// Display information about the client
System.out.println(client2.toString());
// Display the first name
System.out.println("original first name = " +
client2.getFirstName());
// set the first name to the value Rachel
client2.setFirstName("Rachel");
// Retrieve and dislplay the client first name
System.out.println("new first name = " +
client2.getFirstName());
// Display information about the client
System.out.println(client2.toString());
// set their weight to 180
client2.setWeight(180);
// Display information about the client
System.out.println(client2.toString());
}
}
In: Computer Science
Python
#Remember that Fibonacci's sequence is a sequence of
numbers
#where every number is the sum of the previous two numbers.
#
#Joynernacci numbers are similar to Fibonacci numbers, but
#with two differences:
#
# - Fibonacci numbers are famous, Joynernacci numbers are
# not (yet).
# - In Joynernacci numbers, even-indexed numbers are the
# sum of the previous two numbers, while odd-indexed
# numbers are the absolute value of the difference
# between the previous two numbers.
#
#For example: the Joynernacci sequence starts with 1 and 1
#as the numbers at index 1 and 2. 3 is an odd index, so
#the third number would be 0 (1 - 1 = 0). 4 is an even
#index, so the fourth number would be 1 (0 + 1). 5 is an
#odd index, so the fifth number would be 1 (1 - 0). And
#so on.
#
#The first several Joynernacci numbers (and their indices)
#are thus:
#
# 1 1 0 1 1 2 1 3 2 5 3 8 5 13 8 21 13 34 21
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
#Write a function called joynernacci that returns the nth
#Joynernacci number. For example:
#
# joynernacci(5) -> 1
# joynernacci(12) -> 8
#
#We recommend implementing joynernacci recursively, but it
#is not required.
#Write your code here!
#Below are some lines of code that will test your function.
#You can change the value of the variable(s) to test your
#function with different inputs.
#
#If your function works correctly, this will originally
#print: 1, then 8
print(joynernacci(5))
print(joynernacci(12))
In: Computer Science
In: Computer Science
1) List the four most important hardware components of a computer (in your opinion or based on a source) and detail what their function is. You can use the slides or conduct your own research. Make sure you cite any external sources appropriately. (Approximately 300 words)
2) In class, we talked about different protocols that are used to transfer data across networks. Pick two protocols and detail how they work, then compare and contrast them. Finally, discuss when each protocol would be more useful (e.g., protocol x is more useful that protocol y when transferring large quantities of information). As usual cite any sources you used to lookup the protocols. (Approximately 400 words)
3) The last question is an open ended discussion question: what are the environmental impacts of creating and developing technology in such a fast pace? How can we mitigate it? You can include your own answer or do some research to answer these questions in more depth (Approximately 300 words)
In: Computer Science
Take the pseudocode that you developed in your previous
assignment - and convert it into a working program. Or if you think
of a better way of creating a working program – such as what we
discuss in class.
The task was: Write the pseudocode for helping a cashier give you
the correct change. Assume that a person brings hundreds to pennies
to you and wishes to the receive quarters, dimes, and nickels back.
There is a single input of the number of pennies given to the
cashier. There will be several outputs: the number of five dollar
bills, one dollar bills, quarters, dimes, nickels, and remaining
pennies to be returned.
For the input, you will ask the user to enter the number of pennies
(as an integer value) that he/she has. The output will be the
Number of Five Dollar Bills, Number of One Dollar Bills, Quarters,
Number of Dimes, Number of Nickels, and Number of Pennies. Each of
the outputs should be integer values as well.
Provide me with just the source code for this task.
Sample Input:
Enter the number of pennies:
136
Sample Output:
Your change is:
Five Dollar Bills: 0
One Dollar Bills: 1
Quarters: 1
Dimes: 1
Nickels: 0
Pennies: 1
In: Computer Science