Program must be OOP design.
JAVA
This is my program so far. I am having trouble with my delete element method.
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
public class ArrayPlay {
Random rand = new Random();//assign random number variable
private double[] tenNumArray = new double[10];//initiate array containing 10 doubles.
Scanner input = new Scanner(System.in);//create new scanner
public Random getRand() {
return this.rand;
}
public void setRand(Random rand) {
this.rand = rand;
}
public double[] getTenNumArray() {
return this.tenNumArray;
}
public void setTenNumArray(double[] tenNumArray) {
this.tenNumArray = tenNumArray;
} //end getters//setters
//begin method
public void fillArrayAndDisplay() {//begin prompt User method
// #1 Prompt the user to enter 10 doubles and fill an array
System.out.println("Enter ten elements to fill the array");
for (int i = 0; i < this.tenNumArray.length; i++) {//for index equals 1 count plus 1 to 10
this.tenNumArray[i] = input.nextDouble();//placing values index values into the array
}//end for loop
// #2 Print array
System.out.println("The Numbers you entered into the array are");
System.out.printf(Arrays.toString(this.tenNumArray)); // displays user filled array
}//ends prompt User and print method
// #3 Fill an array with 10 random numbers and print the array
public void randomArrayAndDisplay() { //begins random numbers and display array
for (int i = 0; i < this.tenNumArray.length; i++) {
this.tenNumArray[i] = rand.nextInt(10);//create the random numbers using Random class object. set to 10
}
System.out.println("\n The Randomly generated numbers are; ");
System.out.printf(Arrays.toString(this.tenNumArray)); // displays random numbers
}//ends random array and display method
// 4. Sort the array -- then print
public void sortNumberAndDisplay() {
Arrays.sort(this.tenNumArray); //replaces your whole sort function
System.out.println("\n The random numbers sorted are: ");
System.out.printf(Arrays.toString(this.tenNumArray)); // replaces your display line
}// end sort array method
// #5. Delete index[ 3] of the array and re-print the array
//begin delete element method
public void deleteArrayElements(int index) {
// If the array is empty
// or the index is not in array range
// return the original array
if (this.tenNumArray == null
|| index >= this.tenNumArray.length || index < 0) {
System.out.println("\n\n No deletion operation can be performed\n\n");
} else {
double[] tempArray = new double[this.tenNumArray.length - 1];
// Copy the elements except the index
// from original array to the other array
for (int i = 0, k = 0; i < this.tenNumArray.length; i++) {
// if the index is
// the removal element index
if (i == index) {
continue;
}
// if the index is not
// the removal element index
tempArray[k++] = this.tenNumArray[i];
}
// return the resultant array
System.out.println(tempArray[4] + " \n delete num " + " ");
}
}
public void loop(){
fillArrayAndDisplay();//runs prompt user
randomArrayAndDisplay();
sortNumberAndDisplay();
deleteArrayElements(3);//delete index 3
}
}
In: Computer Science
Is there any benchmark for surveying the performance of security architecture?
Test or evaluate the performance.
In: Computer Science
In: Computer Science
Complete the following program. This program should do the following:
1. Creates a random integer in the range 10 to 15 for variable: allThreads, to create a number of threads.
2. Creates a random integer for the size of an ArrayList: size.
3. Each thread obtains a smallest number of a segment of the array. To give qual sized segment to each thread we make the size of the array divisible by the number of threads: while(size%allThreads != 0)size++
4. The program gives random integers to the ArrayList: a.
5. To make sure the smallest number of the entire array is the same of your output, I made a method named: sequentialSmallest(a)
6. The program creates a number of threads. Each thread obtains the smallest number of a segment.
7. You need to complete the method: run() below.
Note: If your answer depends to a variable location that two or more threads are writing to it (changing its value), you must synchronize the variable.
import java.util.*;
public class Main {
public static void main(String[] args) {
// This method is complete. Do not change it.
new Main();
}
public Main() {
Q1Threads();
}
private void Q1Threads(){
// This method is complete. Do not change it.
Random rand = new Random();
int allThreads = rand.nextInt(5) + 10;
int size = rand.nextInt(50) + 1;
while(size%allThreads != 0)size++;
ArrayList<Integer> a = new ArrayList<Integer>(size);
for(int i = 0; i < size; i++)
a.add(rand.nextInt(100) + 10);
sequentialSmallest(a);
MyThread[] thrds = new MyThread[allThreads];
int segment = size/allThreads;
for(int i = 0; i <allThreads ; i++) {
int firstIndex = i * segment;
int lastIndex = i * segment + segment -1;
thrds[i] = new MyThread(a, firstIndex, lastIndex);
}
for(int i = 0; i < allThreads; i++)
thrds[i].start();
try{
for(int i = 0; i < allThreads; i++)
thrds[i].join();
}catch(Exception e){
System.out.println("Error: " + e);
System.exit(0);
}
System.out.println("The smallest number is: " + Shared.result);
}
private static void sequentialSmallest(ArrayList<Integer> a) {
// This method is complete. Do not change it.
int smallest = a.get(0);
for(int i = 0; i < a.size(); i++)
if(a.get(i) < smallest)
smallest = a.get(i);
System.out.println("The list of random numbers is:");
for(int i = 0; i < a.size(); i++)
System.out.print(a.get(i) + ", ");
System.out.println("\nThe smallest number from the sequential list is: " + smallest);
}
}
class MyThread extends Thread{
private ArrayList<Integer> a;
private int from, too;
public MyThread(ArrayList<Integer> a, int from, int too) {
this.a = a;
this.from = from;
this.too = too;
}
public void run(){
// Complete this method
}
}
Answer:
In: Computer Science
I'm having trouble with this program
here's the problem:
A milk carton can hold 3.78 liters of milk.
Each morning, a dairy farm ships cartons of milk to a local grocery
store.
The cost of producing one liter of milk is $0.38, and the profit of each carton of milk is $0.27.
Write a program that does the following:
Here's the program:
#include <stdio.h>
int main(void){
const float cartoncapacity=3.78;
const float costperliter=0.38;
float profitpercarton=0.27;
float milkproduced, milkcost;
int cartonsneeded;
double profit;
printf("Enter, liters, the total quantity of milk produced:\n");
scanf("%f", &milkproduced);
cartonsneeded=((milkproduced+3.78)/cartoncapacity);
printf("Total number of cartons needed to hold:\n");
scanf("%d",&cartonsneeded);
milkcost=costperliter*milkproduced;
profit=profitpercarton*cartonsneeded;
printf("The cost of producing milk $ %f", &milkcost);
printf("Profit: $ %lf",&profit);
return (0);
}
In: Computer Science
1. What's the goal, requirement, and regulation for enterprise architecture?
2. How to survey the performance?
In: Computer Science
Use PHP, javascript and a little bit of Html
More focus on php
Create a logout page (for patients) in hotel management.
Please provide the screenshot of the output too (logout page).
Hint: the logout page should include like this thanks for visting etcetera.
Thanks in advance
In: Computer Science
Project 1: Cloud computing has become a viable and competitive option to the client/server networking model due to its lower cost, scalability, and agility. A local business in your town has asked you to develop a full plan, an analysis to determine the requirement and a design to specify the input, output, and processing prerequisites. Since you are a knowledgeable systems analyst, you have decided to take the job. You understand all the benefits that come along with cloud computing. To assure a functional development life cycle, you have also decided to point out any negative issues with cloud computing such as security, untested new technologies, and training requirement. You are aware that it should take no more than seven weeks to complete the first three phases of SDLC.
Regardless of your topic, you must complete the first three phases of the system development life cycle (SDLC) process: 1. Analysis of the business case 2. Systems analysis a. Requirements modeling b. Data and procedures modeling c. Object modeling 3. Systems design a. Input design b. Output design c. User interface
Software required to complete the project include MS Word, MS Excel, PowerPoint, Visio (or similar package), MS Project, and a statistical package. You may use trial versions of MS Project and Vizio. When using Visio, MS Project, or similar software, ensure that you publish any work as either an image file (.jpeg, .png, etc.) or a pdf before incorporating it into your course project. This is to ensure that your instructor can view/grade your project.
In: Computer Science
Write a MIPS program to implement the Bubble Sort algorithm, that sorts an input list of
integers by repeatedly calling a “swap” subroutine.
The original unsorted list of integers should be received from the keyboard input. Your program should first prompt the user “Please input an integer for the number of elements:”. After the user enters a number and return, your program outputs message “Now input each element and then a return:”. For example, if the user enters 8 as the number of integers, and then the sequence of integers one by one: 6,5,9,1,7,0,-3,2,-8, it should display “The elements are sorted as: -8, -3, 0, 1, 2, 4, 6, 7, 9” (the output sequence of integers should be either space-separated or comma-separated).
The final sorted list (in increasing order) should be stored in the data area, that starts with the label "list:".
You should NOT implement a different sorting algorithm (e.g. mergesort or quick sort). You will receive 0% if your program does not call subroutine "swap", or if your sorted list is in decreasing order.
In: Computer Science
Hanover – Management Decision problems Snyders of Hanover, which sells about 80 million bags of pretzels, snacks chips, and organic snack items each year, had its financial department use spreadsheets and manual processes for much of data gathering and reporting. Hanover’s financial analyst would spend the entire final week of every month collecting spreadsheets from the heads of more than 50 departments worldwide. She would the consolidate and renter all the data into another spreadsheet, which would serve as the company’s monthly profit and loss statement. If a department needed to update its data after submitting the spreadsheet to the main office, the analyst had to return the original spreadsheet, the wait for the department to resubmit its data before finally submitting the updated data in the consolidated document.
1. Assess the impact of the above situation in delayed decision making and its business performance ?
2. As a manager what are your suggestions to improve the above process of data gathering and report generation In your view which type of Information System is required in the above scenario for dealing with the problem of online data processing and report generation ?
3. Why is it necessary for any organization to implement the Information System solution and how its is facilitating the organization in its digital transformation ?
In: Computer Science
Q-2) In a right triangle, the square of the length of one side is equal to the sum of squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle or not.
In: Computer Science
Create a Crow’s Foot notation ERD to support the following business operations:
Create a Crowsfoot notation ERD to support the following business operations: -
A friend of yours has opened Marshfield Electronics and Repairs (MER) to repair smartphones, laptops, tablets, and MP3 players. She wants you to create a database to help her run her business.
When a customer brings a device to MER for repair, data must be recorded about the customer, the device, and the repair (also referred to as repair request). Completing each repair request can involve multiple services (e.g. glass replacement, battery replacement, cleaning. Some services require parts.
The customer’s name, address, and a contact phone number must be recorded.
For the device to be repaired, the type of device, model, and serial number are recorded (or verified if the device is already in the system).
Each repair request is given a reference number, which is recorded in the system along with the date of the request, and a description of the problem(s) that the customer wants fixed.
For each Service, there is a service ID number, description, and charge (amount charged for the service)
Part number, Part description and Price are stored for each part.
Each repair request is associated with only one customer. A customer may submit multiple repair requests.
Each repair request is for the repair of one and only one device. It is possible for a device to be brought to the shop for repair many different times,
Completing a repair request may require the performance of many services. Each service can be performed many different times over multiple repairs, but each service is only performed once during the repair of a device.
Each service may or may not require parts. A service may require many parts. A part is used in one or many services. It is also possible that a part is not used in any service.
Hint: Make sure you convert all M-N relationship to two 1-M relationships to receive a full mark.
In: Computer Science
: Please write a MARIE program to calculate 1+2+3+...+100.
In: Computer Science
Loop and Function
You are asked to develop a compensation calculator application for a department store. At the department store, the compensation of sales staff consists of a base salary and a commission. The base salary is $5,000, and the commission rate is tiered based on sales amount as following:
Sales Amount, commission rate
$0.01 – $5,000, 8%
$5,000.01 – $10,000, 10%
$10,000.01 and above, 12%
For example, if the sales amount is $12,000, the commission is calculated as following: commission = $5,000 * 8% +
($10,000 - $5,000) * 10% + ($12,000 - $10,000) * 12%. You can start with a few specific amounts first to help you figure out the general representation for commission calculation.
Requirements: (1) Define compute_commission function that computes the commission, using the above commission scheme. This function receives one parameter representing the sales amount and returns the corresponding commission.
(2) Define a print_commission function, which receives three parameters representing the beginning sales amount, sales increment, and ending sales amounts, and has no return. This function uses a for-loop to display a sales and commission table. For example, if the beginning sales amount is 10000, sales increment is 5000, and the ending sales amount is 100000, then this function will print out the following table:
Sales Amount | commission
10000 | 900.00
15000 | 1500.00
...
95000. | 11100.00
100000. | 11700.00
Note: this function must call the compute_commission function to
determine the commission column.
(3) Next, define a target_sales function, which receives one parameter representing a desired salary and returns the corresponding sales amount that generates the desired salary. For example, if a staff’s desired salary is 30000 (which consists of base salary + commission), then this function will return a sales amount of 210834, which is the minimum sales amount that the staff must generate to earn the desired 30000 salaries. Note: this function must use a while-loop, and it must call the compute_commission function whenever you want to calculate the commission. In addition, it must start with an initial sales amount of $1 and increases the sales amount only by $1 in each iteration until it finds the sales amount needed to generate the desired salary.
(4) Define the main function, which will call the print_commission function to display a sales-commission table with 10000 as the beginning sales amount, 5000 as the sales increment, and 100000 as the ending sales amount. Then, ask users to enter their desired salary and use it as the argument to call the target_sales function. Lastly, display a message informing user the sales amount needed for the desired salary.
(5) Call the main function. Fix any syntax errors and test your code if you can.
In: Computer Science
In Java programing :
Q1-A Deque supports operations, addFront(), addRear(), removeFront() and removeRear(). Given stacks and their push() and pop() operations only, what are the minimum number of stacks required for this implementation?
A-1, B-2, C-3, D-4,
Q2- True or false and why
The height of a random binary tree with 100 nodes can range from 7 to 100.?
Q3-One can convert a binary tree into its mirror image by swapping each node's left and right childern while traversing it in _______?.
Q4-How to calculate number of node by tree height ?
Q5-The complexity of using sequential search algorithm on a sorted list of n items is ____.
Q6-The data structure that allows deletions at both ends of the list but insertion at only one end is ________. < Which type ?
Q7-What will be the maximum number of comparisons needed with a binary search to find a particular customer's record from a sorted list of 100 records?
Q8-For an array containing 8 elements as: 42, 29, 75, 11, 65, 58, 60, 18, what will be the result of sorting it in ascending order using bubble sort after 2 passes have completed?
In: Computer Science