C# programming
Create a class called A with private integer field x, protected integer field y, public integer field z. Create a class B derived from class A with public integer field d and protected integer field e and private field f.
Write your answer to all three questions below:
In: Computer Science
Using C++, Create a singly Linked List of patients list so that you can sort and search the list by last 4 digits of the patient's Social Security number. Implement Node insertion, deletion, update and display functionality in the Linked List.
Each patient's record or node should have the following data:
Patient Name:
Age:
Last 4 digits of Social Security Number:
The program should first display a menu that gives the user the option to:
1) Add a Patient's record (After adding one patient the user should be prompted: Do you want to add another patient's record? 1 for Yes and 0 for No)
2) Modify a Patient's record ((After modifying/updating one patient the user should be prompted: Do you want to add modify patient's record? 1 for Yes and 0 for No)
3) Delete a Patient's Record ((After deleting one patient the user should be prompted: Do you want to delete another patient's record? 1 for Yes and 0 for No)
4) Display a Patient's record
In: Computer Science
Why is the SISP important for developing a RFP?
In: Computer Science
using python 3
2. Write a python program that finds the numbers that are divisible by both 2 and 7 but not 70, or that are divisible by 57 between 1 and 1000.
3. Write a function called YesNo that receives as input each of the numbers between 1 and 1000 and returns True if the number is divisible by both 2 and 7 but not 70, or it is divisible by 57. Otherwise it returns False.
4. In your main Python program write a for loop that counts from 1 to 1000 and calls this YesNo function inside the for loop and will print "The number xx is divisible by both 2 and 7 but not 70, or that are divisible by 57" if the YesNo function returns True. Otherwise it prints nothing. Note the print statement also prints the number where the xx is above.
In: Computer Science
Language java
Rewrite the method getMonthusing the "this" parameter
CODE:
import java.util.Scanner;
public class DateSecondTry
{
private String month;
private int day;
private int year; //a four digit number.
public void writeOutput()
{
System.out.println(month + " " + day + ", " + year);
}
public void readInput()
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter month, day, and year.");
System.out.println("Do not use a comma.");
month = keyboard.next();
day = keyboard.nextInt();
year = keyboard.nextInt();
}
public int getDay()
{
return day;
}
public int getYear()
{
return year;
}
public int getMonth()
{
if (month.equalsIgnoreCase("January")) return 1;
else if (month.equalsIgnoreCase("February")) return 2;
else if (month.equalsIgnoreCase("March")) return 3;
else if (month.equalsIgnoreCase("April")) return 4;
else if (month.equalsIgnoreCase("May")) return 5;
else if (month.equalsIgnoreCase("June")) return 6;
else if (month.equalsIgnoreCase("July")) return 7;
else if (month.equalsIgnoreCase("August")) return 8;
else if (month.equalsIgnoreCase("September")) return 9;
else if (month.equalsIgnoreCase("October")) return 10;
else if (month.equalsIgnoreCase("November")) return 11;
else if (month.equalsIgnoreCase("December")) return 12;
else
{
System.out.println("Fatal Error");
System.exit(0);
return 0; //Needed to keep the compiler happy
}
}
}
In: Computer Science
HOW TO PRINT THE CONTENTS OF A TWO-DIMENSIONAL ARRAY USING POINTER ARITHMETIC (USING FUNCTIONS)
(C++)
Fill out the function definition for "void print_2darray_pointer(double *twoDD, int row, int col)".
Should match the output from the function void print_2darray_subscript(double twoDD[][ARRAY_SIZE], int row, int col)
# include
using namespace std;
const int ARRAY_SIZE = 5;
const int DYNAMIC_SIZE = 15;
const int TIC_TAC_TOE_SIZE = 3;
// function definitions:
void print_2darray_subscript(double
twoDD[][ARRAY_SIZE], int row, int col)
// printing array using
subscripts
{
for (int i = 0; i < row;
i++)
{
for (int j = 0;
j < col; j++)
{
cout << twoDD[i][j] << " ";
}
cout <<
endl;
}
cout << endl;
}
void print_2darray_pointer(double *twoDD, int row,
int col)
// print array using pointer
arithmetic
{
for (int i = 0; i < row;
i++)
{
for (int j = 0;
j < col; j++)
{
// I tried doing this, but it didn't work : cout
<< *(*(twoDD + i) + j);
// our 2d array is layed out linearly in memory
as contiguous rows, one after another, there are #row rows
// each row has #col columns
// to compute the offset using pointer
math
// offset from twoDD: #row (i) * #col + #col
(j), result: pointer to array element
// ...
}
cout <<
endl;
}
cout << endl;
}
//------------------------------------------------------------------------------
int main()
{
// complete the following function
implementations
// Q#3 - pointer arithmetic, indexing multidimensional
arrays
double twoDDoubles[ARRAY_SIZE][ARRAY_SIZE] = {
{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}
};
cout << endl << "print 2d array of doubles" << endl << endl;
// print 2ddoubles via subscript operator
print_2darray_subscript(twoDDoubles, ARRAY_SIZE,
ARRAY_SIZE);
// print 2ddoubles via pointer arithmetic
print_2darray_pointer((double*)twoDDoubles,
ARRAY_SIZE, ARRAY_SIZE);
cout << endl << endl;
system("pause");
return 0;
}
In: Computer Science
More definitions and example for the following.
a. CPOE
b. Interface engine
c. Telehealth
d. EMR-EHR-PHR
e. Disc mirroring
In: Computer Science
In: Computer Science
In: Computer Science
MergeSort has a rather high memory space requirement, because every recursive call maintains a copy of the sorted subarrays that will be merged in the merge step. What is the memory space requirement in terms of O(.)? Describe how you would implement MergeSort in such a way that merge is done in-place and less memory space is needed? In-place means MergeSort does not take extra memory for the merge operation as in the default implementation.
In: Computer Science
PLEASE NO USE OF LINKED LIST OR ARRAYS(USE CHARACTER POINTERS INSTEAD) TO HOLD DATA STRUCTURES
This lab, for which you may work in groups of two, will require you to use a C structure to hold a record of any kind of data, i.e., address book, library of books as with chapter 14, etc. These records will be held in dynamic memory using memory allocation (malloc) to create new memory and the function (free) to release memory created via (malloc). Do not use linked lists for this assignment, we are using dynamic memory allocation to hold records, not using linked lists. The structures will act as an in memory database for your records (structures), and you will need to create enough memory to hold all of your records, but also when you remove records, you will need to allocate new memory, move the data over to that memory space, and free the old memory (instead of using a static size array). No use of arrays is allowed to hold your structures, but you can use arrays in other places in your program. Your program will prompt for information that will be added to a new structure that will be added when you call the add function. Delete is as simple as just taking the last record out of your database (i.e. no need to search for a “record” to delete - this assignment is about pointers and memory allocation / free, so no need to make the algorithm more complicated). In addition to your memory to hold your data / structures, your program will also need to hold a static duration memory type that will serve as the counter for how many times the database has changed. Along with the amount of times the database has changed, you will also need to have a variable to hold the number of records in your database, functions to calculate size (records multiplied by sizeof struct), and functions to add, print, and delete records. You will not be required to use lookup functions, print is just the entire database. To manage your in-memory database, you will need to use some pointers to hold locations of your data. Please take some time to write down examples of where you will need to have pointers. You will need to have at least a pointer to the beginning of your database memory, another to show which record you are on, but think about the need for other pointers when you think about functions that will delete a record, add a record, etc. One of the major points of this assignment is not just the ability to manage records in memory, it is also about how to manage the memory itself. There is a huge inherent danger in how memory is allocated and subsequently not released properly which will create a “memory leak” in your program which will consume memory over time and crash your system (due to all the memory being used, or your process hitting a max limit of memory). This will mean that you will need to manage how pointers are pointing at data very carefully as it is very easy to create a memory leak and your program will not crash, it will just not release memory properly. You will need a menu to prompt users for the above requirements that may look like: MENU ======= 1. Print all records 2. Print number of records 3. Print size of database 4. Add record 5. Delete record 6. Print number of accesses to database 7. Exit Once you have gathered the appropriate information you will need to manipulate the data to hold the data correctly, but we are not using File I/O to maintain state on the data (would require too much time). Your database is a memory only database, so once your program ends, your database is gone. Being this is the case, it will be important to create a header file that has some data in it (5-7 records), so you will not need to enter all the records every time.
In: Computer Science
You are given a singly linked list. Write a function to find if the linked list contains a cycle or not. A linked list may contain a cycle anywhere. A cycle means that some nodes are connected in the linked list. It doesn't necessarily mean that all nodes in the linked list have to be connected in a cycle starting and ending at the head. You may want to examine Floyd's Cycle Detection algorithm.
/*This function returns true if given linked list has a cycle, else returns false. */ static boolean hasCycle( Node head)
In: Computer Science
The below_freezing function takes a string as its parameter and return True if the temperature specified by the string is below freezing point for water. It returns False if the temperature is at or above the freezing point. The string takes the format of a decimal number followed by a letter where F stands for Fahrenheit, C for Celsius, and K for Kelvin. For example, below_freezing("45.5F") and below_freezing("300K") both return False. below_freezing("-1.2C") and below_freezing("272K") both return True It's critical that you include test case code to show proper testing. PLEASE DO IN PYTHON
In: Computer Science
read in firstNum.
2) read in secondNum.
3) run the loop, If secondNum is 0 then
print out firstNum, otherwise, temp =firstNum % secondNum, firstNum
= secondNum, secondNum = temp.
Your code MUST have your name, and date, and
description of the algorithms as comments.
Submit GCD.java file and the screen shoot of compile
and run result (image file or PDF file) from JGRASP.
//This program demonstrates parts of greatest common
divisor
// It shows how to calculate the remainder of two integers and
also
// how a while loop works with a place holder (temp) variable
// Algorithm
// Read in two positive integer
// Using a while loop, print the remainder value, and then
decrement the value
// Finally, print out the final value of gcd
import java.util.Scanner;
public class GCD {
public static void main(String[] args) {
int firstNum;
int secondNum;
int gcd =0;
Scanner input = new Scanner(
System.in );
//user input the first
number
……………………………………
……………………………………
……………………………………
//user input the second
number
………………………………………
………………………………………..
………………………………………..
//if the second number is
0
//while
loop
while ( secondNum !=
0){
int temp =
firstNum%secondNum;
……….............................................
........................................................
System.out.println(temp);
}
System.out.println("And finally gcd
has the value of " + gcd);
}// of main
} // of class GCD
In: Computer Science
Doing recursion to match digits of two inputted integers. Found this online and it works but I wanna understand how each line works. Like why x %10 == y%10 and calling DigitMatch(x/10,y/10)?
public int digitMatch(int x, int y){
if(x < 0 || y < 0){
throw new IllegalArgumentException();
}
else if(x < 10 || y < 10){
if(x % 10 == y % 10)
return 1;
else
return 0;
} else if( x % 10 == y % 10){
return 1 + digitMatch(x/10, y/10);
}
else{
return digitMatch(x/10,y/10);
}
In: Computer Science