Hi I am quite confused with how to use scanner for my java project? Can someone help me with this? Thanks
In: Computer Science
Consider the various categories of ethics from the module content; Internet Ethics, Cyber Ethics, E-Commerce Ethics, Web Ethics, Business Computer Ethics, and Consumer Computer Ethics.
For this assignment, you will submit your best two scenarios from two separate categories that you devised. Be sure to reference ethical guidelines you learned from the module content and clearly identify the ethical dilemma(s) and/or violation(s).
Minimum requirements:
In: Computer Science
c++ program
Define the following classes to manage the booking of patients in a medical clinic.
a) Define a class Date that has the following integer data members: month, day and year.
b) Define a class AppointmentTime that has the following data members: day (string), hour (int) and minute (int).
c) Define a class Patient with the following data members:
• The name of the patient as a standard library string.
• The date of birth of the patient (from part a).
• Medical insurance number of the patient as a standard library string.
• Name of the doctor for the appointment.
• Day and time of the appointment (from part b). A patient may have a single doctor’s appointment each week.
c) Define a class Doctor with the following data members,
• The name of the doctor as a standard library string.
• The date of birth of the doctor (from part a).
• A two-dimensional string pointer array of 12-by-5 that shows the appointments of that doctor. The appointment durations are 30 mins and they always begin on the hour or half hour. Doctors see patients Monday to Friday during 9.00-12.00 and 14.00-17.00. This array is initialized to empty strings to indicate that at the beginning all the appointments are available. When an appointment is given a pointer to the medical insurance of the patient is stored at that location.
d) Define an AppointmentRequest class with the following data members,
• A Patient object from part (b).
• Doctor’s name.
• The day that appointment is requested as a standard library string (Monday to Friday).
e) Define a class ClinicManager with the following data members,
• An array of pointers to the Patient objects of size 200.
• An array of pointers to the Doctor objects of size 20.
• An integer variable that counts total number of patient appointments given by the clinic in a week. At least the following member functions should be provided,
- A member function that receives a patient object and inserts it to the Patient pointer array. It will check if the patient is already in the array to prevent multiple copies of the patient object in the array.
- A member function that receives a doctor object and inserts to the Doctor pointer array.
- A member function that processes appointment requests. The function will receive an AppointmentRequest object, then will check the requested doctor’s schedule to determine if the appointment can be made. If the appointment can be scheduled it will store the medical insurance of the patient in the appointment array of that doctor. It will create an AppointmentTime object from part b). Then, it will find the patient in the Patient pointer array and store the doctor’s name and AppointmentTime object in the patient object in the Patient pointer array. Finally, the member function will return the AppointmentTime object. If the doctor is already fully booked on that day this object should should return zeros for the appointment time.
- A member function that cancels an appointment, receives doctor’s name and medical insurance of the patient. Then it removes the appointment both from the doctor’s schedule and from the patient.
- A member function that receives a doctor’s name as a parameter and prints name and medical insurance number of all the patients that have booked an appointment with that doctor.
f) Write a driver program that demonstrate the functionality of your program including,
- Creates a ClinicManager object
- Creates doctor objects and calls to the doctor insert member function.
- Creates Patient and AppointmentRequest objects and calls to the member functions that processes the appointments, then outputs the time of the appointment.
Key Considerations for the assignment:
§ You must enforce encapsulation by keeping all data members private.
§ You need to make sure that your classes are well defined using the various concepts seen in the class.
§ Provide needed set/get functions for the data members.
§ Objects should be created dynamically and must be deleted when no longer needed. There should be an output statement confirming the deletion of an object from the destructor function
In: Computer Science
Have a pretty good idea on how to solve this program, I'm just not very accustomed to formatting well in Java for these types of problems. In java, you have full control of what's printed, I just need to get better at it, so I thought I'd post it here to receive an answer to learn from. Thanks for everything guys.
This program must use the Exclusive OR Operator ^ in java, it must also use a while loop. The way it wants to be formatted is also listed.
Write a program that uses a while loop to detect and print multiples of 19 or 23, but not both. Use the exclusive or operator as on page 93. The program should start examining integers at 100, and examine successively larger integers until 15 multiples have been detected. Correct multiples should be printed right aligned in fields that are 6 characters wide, but with only five multiples per line. The total of all correct multiples should be reported after 15 multiples have been printed.
In: Computer Science
1. How does eBay’s original business model contrast with its current business model?
In: Computer Science
Discussion: Cloud Computing in 200 words
In: Computer Science
SQL Questions
1. Select ALL of the TRUE statements.
a. You can control the location of objects within a database onto specific disks/SAN LUNs only if multiple filegroups are created for each disk or SAN LUN
b. Dirty pages are data pages that have been updated in memory,
but not yet written to disk
c. DBCC CHECKDB should be executed at all times to ensure data
integrity
d. SQL Server data files and log files perform best on network shares as opposed to locally connected drives
e. Filegroups apply only to data files and not to log files
f. SQL Server always writes to the transaction log on disk
before any data page is updated in the memory buffers
g. A SQL Server data file can be a part of multiple
filegroups
2. SQL Server 2008 SP4 Enterprise Edition can be upgraded to which of the following SQL Server 2017 editions?
a. SQL Server 2017 Developer Edition
b. SQL Server 2017 Standard Edition
c. SQL Server 2017 Enterprise Edition
d. SQL Server 2017 Express Edition
3. SQL Server 2017 supports compatibility mode for which of the following versions of SQL Server?
Select one or more:
a. SQL Server 2008 R2
b. SQL Server 2005
c. SQL Server 2012
d. SQL Server 2014
e. SQL Server 2008
4. Which of the following statements are true in SQL Server?
Select ALL that apply:
a. SQL Server data files can only grow in multiples of 64K
b. You must pay for all editions of SQL Server
c. Server-side networking for SQL Server is configured at the Database level
d. It is best practice to set Auto_Update_Statistics & Auto_Create_Statistics to FALSE
e. A data page in SQL Server can only hold one object (e.g. a specific table, index, etc.)
f. SQL Server pages can be any size between 8K and 64K
g. You can have multiple versions of SQL Server installed on the same virtual server
5. Which of the following SQL Statements that will provide a list of all tables in the 'AdventureWorks2014" database and nothing else?
Group of answer choices
a. use AdventureWorks2014; Select * from sys.objects where type='TABLE'
b. use AdventureWorks2014; SELECT * FROM INFORMATION_SCHEMA.Tables WHERE TABLE_TYPE = 'BASE TABLE'
c. use AdventureWorks2014; Select * from INFORMATION_SCHEMA.TABLES
d. use AdventureWorks2014; Select * from system.tables
In: Computer Science
This question is about the class Set, as discussed in the lectures. It represents a finite set of int’s. Relevant parts of Set are shown below. The integer count holds the number of elements in the Set. The array elements holds the elements themselves. The class Set also has public methods addElement, equals, isIn, and toString. They are defined as in the lectures, and you can use them if you need to.
class Set
{
private int count;
private int [] elements;
}
Write a public method for Set called both that takes another Set as its only parameter. The method both must return the number of elements that are in both Set’s.
For example, suppose that s1 is an instance of Set with elements 0, 2, 3, and 5. Also suppose that s2 is an instance of Set with elements 0, 1, 3, 4, and 11. Then s1.both(s2) must return 2, because there are two elements 0 and 3 that are in both sets. This is only an example! For full credit, your method both must work for any Set’s, not just the ones mentioned here.
In: Computer Science
Add bubble sort, radix sort, insertion sort, and merge sort to the code provided.
Import a data set (txt file) then do the sorting algorithm to measure how long it took and how many movements occurred.
Please write codes in C++
Here's data set (should be stored in txt file)
7426
4524
4737
9436
3997
2757
6288
5414
9590
5968
6638
3199
9514
1541
9866
2144
6731
911
2171
6135
6437
912
9417
2662
6606
6349
707
2890
5386
9718
3492
5068
9674
8578
8323
7789
4748
7576
2664
6352
7967
8556
4740
5737
6764
368
1070
3700
1291
5279
9429
9507
2575
3099
2147
9660
2515
2976
4086
8305
6913
1308
7123
7678
8971
7507
139
51
5980
1100
3976
7289
9249
1662
8659
2758
3605
1079
7829
2298
3671
8901
1176
9089
3350
7500
6702
8903
5279
Here's the code
#include <bits/stdc++.h>
using namespace std;
using namespace std :: chrono;
#define MAX 1000
void selectionSort(int arr[], int n)
{
int i, j;
for (j = 0; j < n - 1; j++) {
int iMin = j;
for (i = j + 1; i < n; i++) {
if (arr[i] < arr[iMin]) {
iMin = i;
}
}
if (iMin != j) {
int temp = arr[j];
arr[j] = arr[iMin];
arr[iMin] = temp;
}
}
}
void quickSort(int arr[], int first_index, int last_index)
{
int pivotIndex, temp, index_a, index_b;
if (first_index < last_index) {
pivotIndex = first_index;
index_a = first_index;
index_b = last_index;
while (index_a < index_b) {
while (arr[index_a] <= arr[pivotIndex] && index_a <
last_index) {
index_a++;
}
while (arr[index_b] > arr[pivotIndex]) {
index_b--;
}
if (index_a < index_b) {
temp = arr[index_a];
arr[index_a] = arr[index_b];
arr[index_b] = temp;
}
}
temp = arr[pivotIndex];
arr[pivotIndex] = arr[index_b];
arr[index_b] = temp;
quickSort(arr, first_index, index_b - 1);
quickSort(arr, index_b + 1, last_index);
}
}
void shellSort(int arr[], int n)
{
int j;
for (int gap = n / 2; gap > 0; gap /= 2) {
for (int i = gap; i < n; ++i) {
int temp = arr[i];
for (j = i; j >= gap && temp < arr[j - gap]; j -=
gap) {
arr[j] = arr[j - gap];
}
arr[j] = temp;
}
}
}
int main()
{
int arr[MAX], i = 0, size = 0;
ifstream file("data.txt");
while (!file.eof())
{
file >> arr[i];
i++;
}
size = i;
// selection sort
auto startSel = high_resolution_clock :: now();
selectionSort(arr, size);
auto stopSel = high_resolution_clock :: now();
auto durationSel = duration_cast<microseconds>(stopSel -
startSel);
cout << "Time taken by selection sort: " <<
durationSel.count() << " microseconds" << endl;
// quick sort
auto startQuick = high_resolution_clock :: now();
quickSort(arr, 0, size - 1);
auto stopQuick = high_resolution_clock :: now();
auto durationQuick = duration_cast<microseconds>(stopQuick -
startQuick);
cout << "Time taken by quick sort: " <<
durationQuick.count() << " microseconds" << endl;
// shell sort
auto startShel = high_resolution_clock :: now();
shellSort(arr, size);
auto stopShel = high_resolution_clock :: now();
auto durationShel = duration_cast<microseconds>(stopShel -
startShel);
cout << "Time taken by shell sort: " <<
durationShel.count() << " microseconds" << endl;
return 0;
}
In: Computer Science
Java Please
Source Only
Program 3: Distance calc. This question is fairly straightforward. Design (pseudocode) and implement (source code) a program to compute the distance between 2 points. The program prompts the user to enter 2 points (X1, Y1) and (X2, Y2). The distance between 2 points formula is: Square_Root [(X2 – X1)^2 + (Y2 – Y1)^2] Document your code, properly label the input prompts, and organize the outputs as shown in the following sample runs.
In: Computer Science
Write bash shell scripts for the following problems and submit your answers a single.
A ) Write a linux bash shell script that reads your first and lastname as arguments and print them as shown below. In my example, I name the script as printname.sh. In the example, the two arguments follow the shell scriptname. Submit the script and output print screen.
# sh ./printname.sh Abdullah Konak My first name is Abdullah My surname is Konak
B ) Write a linux bash script that will return the largest of the two numbers that are entered as the argument of the script as shown in the example given below. Return your script and a printscreen from your computer.
# sh ./larger.sh 7 5 7 is larger of 5 and 7.
C) Extend the script in part B to any number of numbers entered as arguments as the example given below.
# sh ./largest.sh 7 5 3 8 9 10 10 is the largest of numbers entered.
In: Computer Science
I am trying to get this code to work but I am having difficulties, would like to see if some one can solve it. I tried to start it but im not sure what im doing wrong. please explain if possible
package edu.hfcc;
/*
* Create Java application that will create Fruit class and Bread
class
*
* Fruit class will have 3 data fields name and quantity which you
can change.
* The third data field price should always be 2.0
* Bread class will have 3 data fields name, quantity and price. All
three data fields can change.
*
* Create method that creates the string used write to console and
return from execute()
*
* In GroceryApp
* Create method to calculate totalPrice for fruit
* Create method to calculate totalPrice for bread
* Create method to print to console use EXACLTY like example
below
*
* Data to use
* Bread: Name=French,
Quantity=2, Price=3.0
* Fruit: Name=Apple, Quantity=5,
*
* EXAMPLE TO Console
* French
2 @ 3.0
6.0
Apple
5 @ 2.0
10.0
---------------------
16.0
*/
public class Grocery {
private static final char NEW_LINE = '\n';
private static final String TAB = "\t";
public String execute(){
Fruit fruitOne = new Fruit();
fruitOne.setName("Apple");
fruitOne.setQuantity( 5);
String fruits =
constructOutputFruit(apple);
System.out.println(fruits);
return fruits;
}
private String constructOutputFruit(Fruit fruit1)
{
String apple = fruit1.getName() +
NEW_LINE + fruit1.getQuantity() + TAB + fruit1.getPrice();
return apple + NEW_LINE;
}
}
here are my classes:
Fruit:
package edu.hfcc;
public class Fruit {
private String name;
private int quantity;
private float price;
public Fruit(){
this.price = (float)2.0;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public float getPrice() {
return price;
}
}
Bread:
package edu.hfcc;
public class Bread {
private String name;
private int quantity;
private float price;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
}
In: Computer Science
JAVA please
Program 4: Is there a Prius version? Did you know that the average Boeing 747 airplane uses approximately 1 gallon of fuel per second? Given the speed of the airplane, that means it gets 5 gallons to the mile. No, not 5 miles to the gallon, 5 gallons to the mile. You may be questioning why such a horribly inefficient machine is allowed to exist, but you’ll be happy to find out that, because this airplane hold 568 people, it averages about 0.01 gallons per person – (100 miles per gallon per person). Your job is to design (pseudocode) and implement (source code) a program that asks the user for a distance the plane has to fly (i.e. the length of the trip) and also asks the cost of jet fuel (which is currently $1.80 per gallon). The program should then calculate the total fuel charges to make the trip. Next, ask the user how many people will fly, as well as the average cost of a ticket. Finally, print the total profit made (or lost) and the average gas mileage per person. Document your code and properly label the input prompts and the outputs as shown below.
In: Computer Science
In the second task, you will write a Java program that validates an input to see whether it matches a specified pattern. You will have to read a bit about regular expressions for this Lab.
1. Prompt the user to enter the email address.
2. Read the user input as a String.
3. A regular expression that specifies the pattern for an email address is given by “[a-zA-Z0- 9.]++@[a-zA-Z]++.(com|ca|biz)”. Use this as the input to the matches method in the String class and output the result returned by the method.
4. Prompt the user to enter the full name.
5. Full name should have First name, zero or Middle names and the Last name. For this purpose, we will assume a name (first, middle or last) is a set of characters without any spaces. Some examples are “John”, “McDonald”, “smiTh”. The names are separated by exactly one space. Write a regular expression to represent this pattern.
6. Use the matches method in the String class to validate the name entered by the user and output the result returned by the method.
A possible dialogue with the user might be;
Please enter the email address: [email protected]
true
Please enter the full name: Malaka Second Third Walpola
true
In: Computer Science
Question 1 (10)
Create a class Student with public member variables: Student name,
student number, contact number, ID number. The following
specifications are required:
Add init() method of the class that initializes string member
variables to empty strings and numeric values to 0. (2)
Add the method populate() to the class. The method is used to
assign values to the member variables of the class. (2)
Add the method display() to the class. The method is used to
display the member variables of the class. (2)
Create an instance StudentObj of the class Student in a main
program. (2)
The main program should prompt the user to enter values for five
students. The attributes should be assigned to the instance of
Student using its populate() method, and must be displayed using
the display() method of the instance of Student. (2)
Please make the answer simple and straightforward for a beginner intro to python . Thank you
In: Computer Science