Use the graph of the function f below to find the following. All local minimum values of f All
values at which f has a local minimum If there is more than one answer, separate them with
commas. All local minimum values of f All values at which f has a local minimum:
Solution
Dear student
Thank you for using Chegg
As per the given curve it is clear that the local minimum values of f are -3 & 0
Values of x when curve attain minimum values are x = -2,3.
For this lab, you will write the following filesAbstractDataCalc.pdfalokindustries1
For this lab, you will write the following files:
AbstractDataCalc
AverageDataCalc
MaximumDataCalc
MinimumDataCalc
MUST USE ALL 6 FILES PROVIDED
AbstractDataCalc is an abstract class, that AverageDataCalc, MaximumDataCalc and
MinimumDataCalc all inherit.
The following files are provided
CSVReader
To help read CSV Files.
DataSet
This file uses CSVReader to read the data into a List> type structure. Think of this as a Matrix
using ArrayLists. The important methods for you are rowCount() and getRow(int i) - Between
CSVReader and DataSet - all your data is loaded for you!
Main
This contains a public static void String[] args. You are very free to completely change this main
(and you should!). We don't test your main, but instead your methods directly. However, it will
give you an idea of how the following output is generated.
Sample Input / Output
Given the following CSV file
The output of the provided main is:
Note: the extra line between Set results is optional and not graded. All other spacing must be
exact!
Specifications
You will need to implement the following methods at a minimum. You are free to add additional
methods.
AbstractDataCalc
public AbstractDataCalc(DataSet set) - Your constructor that sets your dataset to an instance
variable, and runCalculations() based on the dataset if the passed in set is not null. (hint: call
setAndRun)
public void setAndRun(DataSet set) - sets the DataSet to an instance variable, and if the passed
in value is not null, runCalculations on that data
private void runCalculations() - as this is private, technically it is optional, but you are going to
want it (as compared to putting it all in setAndRun). This builds an array (or list) of doubles,
with an item for each row in the dataset. The item is the result returned from calcLine.
public String toString() - Override toString, so it generates the format seen above. Method is the
type returned from get type, row counting is the more human readable - starting at 1, instead of
0.
public abstract String getType() - see below
public abstract double calcLine(List line) - see below
AverageDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "AVERAGE"
public abstract double calcLine(List line) - runs through all items in the line and returns the
average value (sum / count).
MaximumDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "MAX"
public abstract double calcLine(List line) - runs through all items, returning the largest item in
the list.
MinimumDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "MIN"
public abstract double calcLine(List line) - runs through all items, returning the smallest item in
the list.
MaximumDataCalc.java------ write code .
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
For each task, submit your source java code file.(1) Objective Im.pdfdhavalbl38
For each task, submit your source java code file.
(1) Objective: Implement Link List
Write a class that maintains the scores for a game application. Implement the addition and
removal function to update the database. The gamescore.txt contains player’ name and score data
record fields separated by comma. For Removal function, uses the name field to select record to
remove the game score record.
Download – List.java, LList.java, Dlink.java, GameEntry.java, gamescore.txt
(a)Read gamescore.txt to initialize the Linked list in sorted order. (1 point)
(b)Provide Remove and Add function for user to update the sorted linked list. (1 point)
(2)Add a reverse function to the LList.java class to reverse the order of the linked list. (2 points).
---------------------------------------------------------------------------------------------------------------------
-----------------------------------------
//gamescore.txt
Mike,1105
Rob,750
Paul,720
Anna,660
Rose,590
Jack,510
--------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------
//DLink.java
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** Doubly linked list node */
class DLink {
private E element; // Value for this node
private DLink next; // Pointer to next node in list
private DLink prev; // Pointer to previous node
/** Constructors */
DLink(E it, DLink p, DLink n)
{ element = it; prev = p; next = n; }
DLink(DLink p, DLink n) { prev = p; next = n; }
/** Get and set methods for the data members */
DLink next() { return next; }
DLink setNext(DLink nextval)
{ return next = nextval; }
DLink prev() { return prev; }
DLink setPrev(DLink prevval)
{ return prev = prevval; }
E element() { return element; }
E setElement(E it) { return element = it; }
}
--------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------
//GameEntry.java
public class GameEntry {
protected String name;
protected int score;
public GameEntry(String n, int s) {
name = n;
score = s;
}
public String getName() {return name;}
public int getScore() {return score;}
public String toString() {
return \"(\"+name+\",\"+score+\")\";
}
}
--------------------------------------------------------------------------------------------------------------------
----------------------------------
//List.java
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** List ADT */
public interface List {
/** Remove all contents from the list, so it is once again
empty. Client is responsible for reclaiming storage
used by the list elements. */
p.
Stata cheat sheet: programming. Co-authored with Tim Essam (linkedin.com/in/timessam). See all cheat sheets at http://bit.ly/statacheatsheets. Updated 2016/06/04
For this lab, you will write the following filesAbstractDataCalc.pdfalokindustries1
For this lab, you will write the following files:
AbstractDataCalc
AverageDataCalc
MaximumDataCalc
MinimumDataCalc
MUST USE ALL 6 FILES PROVIDED
AbstractDataCalc is an abstract class, that AverageDataCalc, MaximumDataCalc and
MinimumDataCalc all inherit.
The following files are provided
CSVReader
To help read CSV Files.
DataSet
This file uses CSVReader to read the data into a List> type structure. Think of this as a Matrix
using ArrayLists. The important methods for you are rowCount() and getRow(int i) - Between
CSVReader and DataSet - all your data is loaded for you!
Main
This contains a public static void String[] args. You are very free to completely change this main
(and you should!). We don't test your main, but instead your methods directly. However, it will
give you an idea of how the following output is generated.
Sample Input / Output
Given the following CSV file
The output of the provided main is:
Note: the extra line between Set results is optional and not graded. All other spacing must be
exact!
Specifications
You will need to implement the following methods at a minimum. You are free to add additional
methods.
AbstractDataCalc
public AbstractDataCalc(DataSet set) - Your constructor that sets your dataset to an instance
variable, and runCalculations() based on the dataset if the passed in set is not null. (hint: call
setAndRun)
public void setAndRun(DataSet set) - sets the DataSet to an instance variable, and if the passed
in value is not null, runCalculations on that data
private void runCalculations() - as this is private, technically it is optional, but you are going to
want it (as compared to putting it all in setAndRun). This builds an array (or list) of doubles,
with an item for each row in the dataset. The item is the result returned from calcLine.
public String toString() - Override toString, so it generates the format seen above. Method is the
type returned from get type, row counting is the more human readable - starting at 1, instead of
0.
public abstract String getType() - see below
public abstract double calcLine(List line) - see below
AverageDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "AVERAGE"
public abstract double calcLine(List line) - runs through all items in the line and returns the
average value (sum / count).
MaximumDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "MAX"
public abstract double calcLine(List line) - runs through all items, returning the largest item in
the list.
MinimumDataCalc
Extends AbstractDataCalc. Will implement the required constructor and abstract methods only.
public abstract String getType() - The type returned is "MIN"
public abstract double calcLine(List line) - runs through all items, returning the smallest item in
the list.
MaximumDataCalc.java------ write code .
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
For each task, submit your source java code file.(1) Objective Im.pdfdhavalbl38
For each task, submit your source java code file.
(1) Objective: Implement Link List
Write a class that maintains the scores for a game application. Implement the addition and
removal function to update the database. The gamescore.txt contains player’ name and score data
record fields separated by comma. For Removal function, uses the name field to select record to
remove the game score record.
Download – List.java, LList.java, Dlink.java, GameEntry.java, gamescore.txt
(a)Read gamescore.txt to initialize the Linked list in sorted order. (1 point)
(b)Provide Remove and Add function for user to update the sorted linked list. (1 point)
(2)Add a reverse function to the LList.java class to reverse the order of the linked list. (2 points).
---------------------------------------------------------------------------------------------------------------------
-----------------------------------------
//gamescore.txt
Mike,1105
Rob,750
Paul,720
Anna,660
Rose,590
Jack,510
--------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------
//DLink.java
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** Doubly linked list node */
class DLink {
private E element; // Value for this node
private DLink next; // Pointer to next node in list
private DLink prev; // Pointer to previous node
/** Constructors */
DLink(E it, DLink p, DLink n)
{ element = it; prev = p; next = n; }
DLink(DLink p, DLink n) { prev = p; next = n; }
/** Get and set methods for the data members */
DLink next() { return next; }
DLink setNext(DLink nextval)
{ return next = nextval; }
DLink prev() { return prev; }
DLink setPrev(DLink prevval)
{ return prev = prevval; }
E element() { return element; }
E setElement(E it) { return element = it; }
}
--------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------
//GameEntry.java
public class GameEntry {
protected String name;
protected int score;
public GameEntry(String n, int s) {
name = n;
score = s;
}
public String getName() {return name;}
public int getScore() {return score;}
public String toString() {
return \"(\"+name+\",\"+score+\")\";
}
}
--------------------------------------------------------------------------------------------------------------------
----------------------------------
//List.java
/** Source code example for \"A Practical Introduction to Data
Structures and Algorithm Analysis, 3rd Edition (Java)\"
by Clifford A. Shaffer
Copyright 2008-2011 by Clifford A. Shaffer
*/
/** List ADT */
public interface List {
/** Remove all contents from the list, so it is once again
empty. Client is responsible for reclaiming storage
used by the list elements. */
p.
Stata cheat sheet: programming. Co-authored with Tim Essam (linkedin.com/in/timessam). See all cheat sheets at http://bit.ly/statacheatsheets. Updated 2016/06/04
File LinkedList.java Defines a doubly-l.pdfConint29
File: LinkedList.java
/**
* Defines a doubly-linked list class
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
/**
* Returns the value stored in the first node
* @precondition
* @return the value stored at node first
* @throws NoSuchElementException
*/
public T getFirst() throws NoSuchElementException {
return null;
}
/**
* Returns the value stored in the last node
* @precondition
* @return the value stored in the node last
* @throws NoSuchElementException
*/
public T getLast() throws NoSuchElementException {
return null;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
return null;
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return -1;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return false;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return false;
}
/**** MUTATORS ****/
/**
* Creates a new first element
* @param data the data to insert at the front of the LinkedList
* @postcondition
*/
public void addFirst(T data) {
return;
}
/**
* Creates a new last element
* @param data the data to insert at the end of the LinkedList
* @postcondition
*/
public void addLast(T data) {
return;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
return;
}
/**
* removes the element at the front of the LinkedList
* @precondition
* @postcondition
* @throws NoSuchElementException
*/
public void removeFirst() throws NoSuchElementException {
return;
}
/**
* removes the element at the end of the LinkedList
* @precondition
* @postcondition
* @throws NoSuchElementException
*/
public void removeLast() throws NoSuchElementException {
return;
}
/**
* removes the element referenced by the iterator
* @precondition
* @pos.
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdfganisyedtrd
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switch (c)
{
case 'a':
// input item record from user
printf("\nEnter item name: ");
fgets(itemName_input, sizeof(itemName_input), s.
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
Background:
In many applications, the composition of a collection of data items changes over time. Not only
are new data items added and existing ones removed, but data items may be duplicated. A list
data structure is a member of the general category of abstract data types called containers, whose
purpose is to hold other objects. In C++, lists are provided in the Standard Template Library.
However, for this assignment you will design and write your own linked list implementation to
support the ADT operations specified below.
Objective:
Design and implement the specifications for a List Abstract Data Type where the items in the list
are unsorted.
Requirements:
Define a list and develop a set of operations for creating and manipulating a list that satisfies the
list ADT specification.
List ADT Specification
Structure: The list elements are of ItemType. The list has a property called the current position
which designates the position of the last element accessed by GetNextItem during an iteration
through the list. Only ResetList and GetNextItem alter the current position.
Definitions (provided by the user):
MAX_ITEMS: A constant specifying the maximum capacity of items allowed on the list
Item Type: Class encapsulating the type of items in the list
RelationType: An enumeration type that consists of LESS, GREATER, EQUAL
Member function of ItemType that must be included:
RelationType ComparedTo(ItemType Item)
Function: Determines the ordering of two ItemType objects based on their keys
Precondition: Self and item have their key members initialized
Postcondition:
Function value = LESS if the key of self is less than the key of item
= GREATER if the key of self is greater than the key of item
= EQUAL if the keys are equal
Operations (provided by Unsorted List ADT)
Make Empty
Function: Initializes list to empty state
Preconditions: None
Postcondition: List is empty
Boolean IsFull
Function: Determines whether list is full
Preconditions: List has been initialized
Postcondition: Function value = (list is full)
int GetLength
Function: Determines the number of elements in list
Preconditions: List has been initialized
Postcondition: Function value = number of elements in list
ItemType GetItem(Item Typeitem, Boolean& found)
Function: Get list element whose key matches item’s key (if present)
Preconditions: List has been initialized
Key member of item is initialized
Postcondition: If there is an element someItem whose keymatches item’s key, then found =
true and copy of someItemis returned; otherwise found = false and item is returned
List is unchanged
PutItem(ItemType item)
Function: Puts item into list
Preconditions: List has been initialized
List is not full
Item is not in list
Postcondition: Item is in the list
DeleteItem(ItemType item)
Function: Deletes the element whose key matches item’s key
Preconditions: List has been initialized
Postcondition: One and only one element in list has a key matching item’s key
ResetList
Function: Initializes current p.
Please the following is the currency class of perious one- class Curre.pdfadmin463580
Please the following is the currency class of perious one.
class Currency {
protected:
int whole;
int fraction;
virtual std::string get_name() = 0;
public:
Currency() {
whole = 0;
fraction = 0;
}
Currency(double value) {
if (value < 0)
throw "Invalid value";
whole = int(value);
fraction = std::round(100 * (value - whole));
}
Currency(const Currency& curr) {
whole = curr.whole;
fraction = curr.fraction;
}
/* This algorithm gets the whole part or fractional part of the currency
Pre: whole, fraction - integer numbers
Post:
Return: whole or fraction
*/
int get_whole() { return whole; }
int get_fraction() { return fraction; }
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void set_whole(int w) {
if (w >= 0)
whole = w;
}
void set_fraction(int f) {
if (f >= 0 && f < 100)
fraction = f;
}
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void add(const Currency* curr) {
whole += curr->whole;
fraction += curr->fraction;
if (fraction > 100) {
whole++;
fraction %= 100;
}
}
/* This algorithm subtracts an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void subtract(const Currency* curr) {
if (!isGreater(*curr))
throw "Invalid Subtraction";
whole -= curr->whole;
if (fraction < curr->fraction) {
fraction = fraction + 100 - curr->fraction;
whole--;
}
else {
fraction -= curr->fraction;
}
}
/* This algorithm compares the an object of the same currency for equality or inequality
Pre: object (same currency)
Post:
Return: whole/fraction
*/
bool isEqual(const Currency& curr) {
return curr.whole == whole && curr.fraction == fraction;
}
/* This algorithm compares the an object of the same currency to determine which is greater or
smaller
Pre: object (same currency)
Post:
Return: true/false
*/
bool isGreater(const Currency& curr) {
if (whole < curr.whole)
return false;
if (whole == curr.whole && fraction < curr.fraction)
return false;
return true;
}
/* This algorithm prints the name and value of the currency object
Pre: value of whole, fraction, and the name
Post: whole, fraction, get_name()
Return:
*/
void print() {
std::cout << whole << "." << fraction << " " << get_name() << std::endl;
}
};
class Krone : public Currency {
protected:
/*
This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Krone
Post:
Return: name
*/
std::string name = "Krone";
std::string get_name() {
return name;
}
public:
Krone() : Currency() { }
Krone(double value) : Currency(value) { }
Krone(Krone& curr) : Currency(curr) { }
};
class Soum : public Currency {
protected:
/* This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Soum
Post:
Return: name
*/
std::string name = "Soum";
std::string get_name() {
return name;
}
public:
Soum() : Currency() { }
Soum(double value) : Currency(value) { }
Soum(Krone& curr) : Currency(curr) { }
};
A LinkNode structure or class which will have two attrib.
please follow all instructions and answer the inbedded questions- and.pdfIan5L3Allanm
please follow all instructions and answer the inbedded questions, and written in C pls
// Write your name here
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switch (c)
{
case 'a'.
In java , I want you to implement a Data Structure known as a Doubly.pdfaromalcom
In java , I want you to implement a Data Structure known as a Doubly-Ended-Queue. it is a
“fair” data structure in that it implements a FIFO (First In First Out ) behavior. As such, it is
often used to implement various wait lists in computer systems. For example, jobs waiting to use
the CPU, jobs waiting for a printer, jobs waiting to be placed into RAM for execution. In short,
whenever we want a fair strategy for waiting we use queues.
A DEQUE (Doubly-ended-queue) is a related data structure. Although similar to a Queue, it
differs in that it allows for insertions AND deletions from either end of the list (both the front
and the rear).
Your implementation MUST use a doubly-linked-list implementation. You may not use a static
array implementation.
Thus, a Deque is a List but it is one which only concerns itself with the first and last positions for
any insertion or deletion. The 6 operations supported are :
public void insertFront( int item ) - insert the given item (as a node) into the first position of the
Deque.
public void insertRear( int item ) - insert the given item (as a node) into the last position of the
Deque.
public int deleteFront( ) - delete and return the element stored in the first node of the Deque.
public int deletRear( ) – delete and return the element stored in the last node of the Deque.
public boolean isempty( ) - returns true if the Deque is currently empty or false if it is not.
public void printDeque( ) - print the integers from the list, one per line, from the first element
through to the last in order.
Classes
Your program must implement the following 3 classes. public class dequeDriver
This class will contain your program’s main method. It will need to declare a deque object and
process input as indicated below.
Your program should prompt the user for the path of an input file. It should open the file for
input and process it line by line. Each line of the input file will have one of the following forms.
PR
IF
IR
DF
DR
The meanings of each input is as follows:
PR - print the current contents of the deque from front to rear using the printDeque( ) method of
the deque object.
IF - insert the given int value into the front of the deque.
IR - insert the given int value into the rear of the deque.
DF - delete the front value from the deque.
DR – delete the rear element of the deque.
Below is an example input file that your program should be able to process.
PR
IF 4
IF 5
IF 6
IR 7
PR
DR
PR
DF
PR
The output for the input file shown above is :
EMPTY DEQUE
----- Front -----
6
5
4
7
----- Rear -----
----- Front -----
6
5
4
----- Rear -----
----- Front -----
5
4
----- Rear -----
public class dequeNode
This class will implement the linked nodes that will be used to implement the deque itself.
It should have the following protected data members.
protected dequeNode next; // next pointer to next node
protected dequeNode prev; // previous pointer to previous node
protected int val; // the integer value stored within the dequeNod.
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
Getting Started
Create a class called Lab8. Use the same setup for setting up your class and main method as you
did for the previous assignments. Be sure to name your file Lab8.java. Additionally, make
another file called Arrays.java. This file will be an object, so simply start it off by declaring an
Arrays class. You can copy the following skeleton and fill in the appropriate code below each of
the comments:
public class Arrays {
/ Instance Variables
// Constructors
// findMin 1
// findMax
// calcSum
// calcAverage
// toString
}
Task Overview
Your task for this lab is to create a class called Arrays with some array processing methods. This
class will maintain an array and the number of elements present in it. Additionally, methods will
be available to display the current min and max elements along with the average of all of them.
Finally, a toString() method will be available to cleanly display all the array elements. Finally,
you will write a simple driver class to test out the above Arrays class.
Part 1: Instance Variables for Arrays
The first thing to do for the Arrays class is to set up its instance variables. Declare the following
(private) instance variables:
• An int array called array ? this will be the array we will be writing methods for.
• An int called count - this represents the number of valid elements in the array.
Part 2:
Constructors for Arrays The Arrays class will have two constructors. The first constructor takes
the maximum size of the array as input as a parameter and initializes the array instance variable
appropriately. It also sets count to size. Finally, it will initialize all of the array elements to some
values between 0 and 10, inclusive. To create this constructor, follow these steps:
• Import java.util.Random to make use of the random number generator.
• Create a constructor with the following header: public Arrays(int size)
• Initialize your array variable and set its size to size (see the chart on page 252 for reference on
initializing arrays). Be very careful that you are setting the value of your array instance variable,
as opposed to creating a new variable called array.
• Set the value of the count variable to size because we will be populating the entire array.
• Copy the following code to the constructor in order to generate random values between 0 and
10, inclusive:
Random rand = new Random();
for (int i = 0; i < count; i++)
{
array[i] = (rand.nextInt(10));
}
Next, create another constructor with the following header: public Arrays(int[] arr). This
constructor will initialize the class by using the passed arr argument in order to fill its instance
variables. The following things need to be done inside of this constructor:
• Set the array variable equal to arr.
• Set the count variable equal to the length of the array.
Part 3: Displaying the Output findMin()
The first method of this class will search the array for the minimum element. Copy the following
code for the findMin method. Note how the count i.
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
This is a java lab assignment. I have added the first part \"java retail class\" at the bottom. I am
unsure how to read the txt file into an array from the retail class. The stock txt file has been
added also.
A beginning framework and inventory list has been provided to you to use your Retail Item Class
as an array. Develop a program to accomplish the following menu items that can be selected by
the end user. Discussion of what each menu item should do is provided below the menu item.
Modify your object class file as desired. Please append initials to files created. Use Select-Case
for menu choices and methods to perform those choices. Please make a selection: 1. Open
Inventory File (This should ask the user for the file name, open the file and load the data into the
object array). 2. Display All (This should show a table of all items and data) 3. Display Reorder
Only (This should show only the stock number, Description and current quantity for items
requiring reorder) 4. Find Stock number (Allows the user to enter part of the description and
displays all matching stock numbers and descriptions matching that - case insensitive, such as
“cubs” or “cubs”) 5. Display Stock number (Allows user to enter stock number and displays
record of item) 6. Add Quantity (Asks for stock number and quantity for units, adds it to current,
displays record results) 7. Subtract Quantity (Asks for stock number and quantity, subtracts,
displays results including if reorder is needed.) 8. Change Price (Asks for stick number, changes
price to provided value, display results). 9. New Item (Allows adding a new item, updates count.
Display record results). 10. Save Inventory File (asks user for file name, save all inventory to
that file in a format that can be read back.)
public class RetailItem{
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public void setUnitsOnHand(int userUnitsOnHand){
unitsOnHand=userUnitsOnHand;
}
public void setPrice(double userPrice){
price=userPrice;
}
public String getDescription(){
return description;
}
public int getUnitsOnHand(){
return unitsOnHand;
}
public double getPrice(){
return price;
}
public double getTotal(){
int total = unitsOnHand=(int) price;
return total;
}
public boolean getRestock(){
return false;
}
public RetailItem(String descriptionGiven, int unitsOnHandGiven, double priceGiven, int
restockGiven){
description=descriptionGiven;
unitsOnHand=unitsOnHandGiven;
price=priceGiven;
restock=restockGiven;
}
}
Solution
public class RetailItem{
private int stocknumber;
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public int getStocknumber() {
return stocknumber;
}
public void setStocknumber(int stocknumber) {
this.stocknumber = stocknumber;
}
public void setUnitsOnHand(in.
Introduction to objects and inputoutput Ahmad Idrees
Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
written in c- please answer the 4 questions and write the functions ba.pdfsravi07
written in c, please answer the 4 questions and write the functions based on the given code.
Thank you
// Write your name here
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switc.
Write a function which return a list of all of the n element subset .pdfhardjasonoco14599
Write a function which return a list of all of the n element subset of a given set
Implement in JAVA Question 3 Write a function that returns a list of all of the n-element subsets
of a given set. For example, if the given set is [1,2,3] and n is 2, then the returned list should
contain [1,2], [1,3], and [2,3]. The order of the elements is not important.
Solution
The program for this problem is as follows:
Comments are included in the program for explaining the steps.
A sample output is attached below the program.
package com.temp;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* Program to find sublists of a list.
* @author Rohit Phatak
*
*/
public class subset {
/**
* This list will contain the resultant sublists.
*/
static List list = new ArrayList<>();
public static void main(String arg[]){
/**
* Input a list comma separated.
*/
System.out.println(\"Enter a list : \");
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
String[] sArr = s.split(\",\");
/**
* Input a value of n.
*/
System.out.println(\"Enter value of n : \");
Integer n = scanner.nextInt();
/**
* Check if value of n is greater than entered list.
*/
if(sArr.length < n){
System.out.println(\"Length of list is less than value of n\");
} else if(sArr.length > 0){
getSubsetList(sArr,n);
System.out.println(\"List is as :\");
/**
* Printing the sublists.
*/
for(String[] str : list){
String printVar = \"\";
for(String temps : str)
printVar+=temps+\",\";
System.out.println(\"[\"+printVar.substring(0, printVar.length()-1)+\"]\");
}
} else {
System.out.println(\"Please enter atleast one element:\");
}
scanner.close();
}
/**
* This method calls the recursive function which is used to obtain the sublists.
* @param sArr
* @param n
* @return
*/
public static List getSubsetList(String[] sArr,Integer n){
List lista = new ArrayList<>();
sublist(sArr, 0, n, new String[n]);
return lista;
}
/**
* This is a recursive function.
* This function will iterate over itself for finding the sublist.
*
* Parameters are as follows:
*
* @param arr -> List entered by the user.
* @param n -> Value of sublist entered by user.
* @param startPosition -> index to start creating the sublist.
* @param result -> resultant sublist
*/
public static void sublist(String[] arr, int startPosition, int n, String[] result){
/**
* Check for the value of n ==0.
* If n==0 break from the recursion.
*/
if (n == 0){
/**
* Add the sublist \'result\' in the list.
*/
list.add(result.clone());
return;
}
/**
* Iterate through for loop starting from startPosition till length of list minus entered value
n.
*/
for (int i = startPosition; i <= arr.length-n; i++){
/**
* Here result is a temporary sublist.
* This for loop adds an element to the temporary sublist in each iteration.
* The element is added from the complete list entered by user.
* Location of element is iTh index.
*/
result[result.length - n] = arr[i];
/**
* After adding the element to the temporary sublist, the sublist an.
Change the code in Writer.java only to get it working. Must contain .pdfsecunderbadtirumalgi
Change the code in Writer.java only to get it working. Must contain methods: logReverse() ,
logMax(), logDuplicates(),
This lab is going to focus on File Output, which you will find is somewhat similar to console
output.
FileMain.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class FileMain {
public static void main(String[] args) throws IOException{
Scanner scnr = new Scanner(System.in);
System.out.print("Please enter the name of the file you would like to read: ");
String fileName = scnr.next();
Reader reader = new Reader();
ArrayList fileContents = reader.getFileContents(fileName);
System.out.println("Please enter a name for your new file: ");
String newFileName = scnr.next();
Writer fileOut = new Writer(newFileName);
fileOut.logReverse(fileContents);
fileOut.logMax(fileContents);
fileOut.logDuplicates(fileContents);
fileOut.closeWriter();
scnr.close();
}
}
Filetester.java
import java.io.IOException;
import java.util.ArrayList;
public class FileTester {
public static boolean testLogReverse(ArrayList contents) throws IOException {
Writer writer = new Writer("logReverseTest.txt");
writer.logReverse(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("Reversed file contents: ");
expected.add("58");
expected.add("12");
expected.add("19");
expected.add("42");
expected.add("12");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logReverseTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static boolean testLogMax(ArrayList contents) throws IOException {
Writer writer = new Writer("logMaxTest.txt");
writer.logMax(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("The largest number in the file is: 58");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logMaxTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static boolean testLogDuplicates(ArrayList contents) throws IOException {
Writer writer = new Writer("logDuplicatesTest.txt");
writer.logDuplicates(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("Duplicates found: true");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logDuplicatesTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static void main(String[] args) throws IOException {
Reader reader = new Reader();
ArrayList fileContents = reader.getFileContents("nums.txt");
System.out.println("logReverse test passed? " + testLogReverse(fileContents));
System.out.println("logMax test passed? " + testLogMax(fileContents));
System.out.println("logDuplicates test passed? " + testLogDuplicates(fileContents));
}
}
Reader.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Sca.
Sorted number list implementation with linked listsStep 1 Inspec.pdfalmaniaeyewear
Sorted number list implementation with linked lists
Step 1: Inspect the Node.java file
Inspect the class declaration for a doubly-linked list node in Node.java. Access Node.java by
clicking on the orange arrow next to LabProgram.java at the top of the coding window. The
Node class has three fields:
a double data value,
a reference to the next node, and
a reference to the previous node.
Each field is protected. So code outside of the class must use the provided getter and setter
methods to get or set a field.
Node.java is read only, since no changes are required.
Step 2: Implement the insert() method
A class for a sorted, doubly-linked list is declared in SortedNumberList.java. Implement the
SortedNumberList class's insert() method. The method must create a new node with the
parameter value, then insert the node into the proper sorted position in the linked list. Ex:
Suppose a SortedNumberList's current list is 23 47.25 86, then insert(33.5) is called. A new
node with data value 33.5 is created and inserted between 23 and 47.25, thus preserving the list's
sorted order and yielding: 23 35.5 47.25 86
Step 3: Test in develop mode
Code in main() takes a space-separated list of numbers and inserts each into a SortedNumberList.
The list is displayed after each insertion. Ex: If input is
then output is:
Try various program inputs, ensuring that each outputs a sorted list.
Step 4: Implement the remove() method
Implement the SortedNumberList class's remove() method. The method takes a parameter for the
number to be removed from the list. If the number does not exist in the list, the list is not
changed and false is returned. Otherwise, the first instance of the number is removed from the
list and true is returned.
Uncomment the commented-out part in main() that reads a second input line and removes
numbers from the list. Test in develop mode to ensure that insertion and removal both work
properly, then submit code for grading. Ex: If input is
then output is:
Given templates:
LabProgram.java
import java.util.Scanner;
import java.io.PrintWriter;
public class LabProgram {
// Prints the SortedNumberList's contents, in order from head to tail
public static void printList(SortedNumberList list) {
Node node = list.head;
while (null != node) {
System.out.print(node.getData() + " ");
node = node.getNext();
}
System.out.println();
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
String inputLine;
// Read the line of input numbers
inputLine = scnr.nextLine();
// Split on space character
String[] terms = inputLine.split(" ");
// Insert each value and show the sorted list's contents after each insertion
SortedNumberList list = new SortedNumberList();
for (Object term : terms) {
double number = Double.parseDouble(term.toString());
System.out.println("List after inserting " + number + ": ");
list.insert(number);
printList(list);
}
/*
// Read the input line with numbers to remove
inputLine = scnr.nextLine();
terms = inputLine.split(" ".
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdffms12345
EX 25-15 Decision on accepting additional business Brightstone Tire and Rubber Company has
capacity to produce 170,000 tires. Brightstone presently produces and sells 130,000 tires for the
North American market at a price of $175 per tire. Brightstone is evaluating a special order from
a European automobile com- pany, Euro Motors. Euro is offering to buy 20,000 tires for $116
per tire. Brightstone\'s accounting system indicates that the total cost per tire is as follows: OBJ.
1 $ 56 Direct materials Direct labor Factory overhead (60% variable) Selling and administrative
expenses (45% variable) Total 25 26 $129 Brightstone pays a selling commission equal to 5% of
the selling price on North Ameri- can orders, which is included in the variable portion of the
selling and administrative expenses. However, this special order would not have a sales
commission. If the order was accepted, the tires would be shipped overseas for an additional
shipping cost of $7.50 per tire. In addition, Euro has made the order conditional on receiving
European safety certification. Brightstone estimates that this certification would cost $165,000.
a. Prepare a differential analysis dated January 21 on whether to reject (Alternative 1) or accept
(Alternative 2) the special order from Euro Motors. b. What is the minimum price per unit that
would be financially acceptable to Brightstone?
Solution
1.
2.Differential AnalysisReject Order (Alt. 1) or Accept Order (Alt.2)January 21Reject
OrderAccept OrderDifferential Effect on Income(Alternative 1)(Alternative 2)(Alternative
2)Revenues 22,750,000 25,070,000
2,320,000(130000*175)(130000*175)+(20000*116)CostsDirect Materials
7,280,000 8,400,000 1,120,000(130000*56)(150000*56)Direct
Labor 2,860,000 3,300,000
440,000(130000*22)(150000*22)Variable Factory Overhead 1,950,000
2,250,000 300,000(60% of
25)(130000*60%*25)(150000*60%*25)Variable Selling and Admin Expenses15210001580000
59,000(45% of 26)(130000*45%*26)(130000*45%*26)+(20000*2.95Shipping cost
- 150,000
150,000(20000*7.5)Certification cost -
165,000 165,000Income (Loss) 9,139,000
9,225,000 86,000Bright stone should accept the special order from Euro Motors.
Describe the procedure you would use in the laboratory to determine .pdffms12345
Describe how relational databases are used in OLAP analysis, data mining, and E-commerce
website applications.
Solution
Relational DataBase Management System used for OLTP Database Systems:
OLAP with relational data base called ROLAP ROLAP works directly with relational databases
management system. The base data and the dimension tables are stored as relations and new
relations are created to hold the aggregated data. It depends on a specialized design schema. This
methodology relies on manipulating the information stored in the relational database to give the
appearance of traditional OLAP\'s slicing and dicing functionality.
When Data mining use RDBMS(Relational DataBase Management System) We called
Relational data mining Data mining algorithms look for patterns in information. Relational data
mining (RDM) scheams are based on inductive logic programming , find patterns that involve
relation tables from a relational database.
Ecommerce entrepreneurs: It use relational databases work business decisions
Selecting shopping cart software and hiring one web developer over another..
More Related Content
Similar to Using Array Approach, Linked List approach, and Delete Byte Approach.pdf
File LinkedList.java Defines a doubly-l.pdfConint29
File: LinkedList.java
/**
* Defines a doubly-linked list class
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
/**
* Returns the value stored in the first node
* @precondition
* @return the value stored at node first
* @throws NoSuchElementException
*/
public T getFirst() throws NoSuchElementException {
return null;
}
/**
* Returns the value stored in the last node
* @precondition
* @return the value stored in the node last
* @throws NoSuchElementException
*/
public T getLast() throws NoSuchElementException {
return null;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
return null;
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return -1;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return false;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return false;
}
/**** MUTATORS ****/
/**
* Creates a new first element
* @param data the data to insert at the front of the LinkedList
* @postcondition
*/
public void addFirst(T data) {
return;
}
/**
* Creates a new last element
* @param data the data to insert at the end of the LinkedList
* @postcondition
*/
public void addLast(T data) {
return;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
return;
}
/**
* removes the element at the front of the LinkedList
* @precondition
* @postcondition
* @throws NoSuchElementException
*/
public void removeFirst() throws NoSuchElementException {
return;
}
/**
* removes the element at the end of the LinkedList
* @precondition
* @postcondition
* @throws NoSuchElementException
*/
public void removeLast() throws NoSuchElementException {
return;
}
/**
* removes the element referenced by the iterator
* @precondition
* @pos.
-- Write the compiler used- Visual studio or gcc -- Reminder that your.pdfganisyedtrd
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switch (c)
{
case 'a':
// input item record from user
printf("\nEnter item name: ");
fgets(itemName_input, sizeof(itemName_input), s.
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
Background:
In many applications, the composition of a collection of data items changes over time. Not only
are new data items added and existing ones removed, but data items may be duplicated. A list
data structure is a member of the general category of abstract data types called containers, whose
purpose is to hold other objects. In C++, lists are provided in the Standard Template Library.
However, for this assignment you will design and write your own linked list implementation to
support the ADT operations specified below.
Objective:
Design and implement the specifications for a List Abstract Data Type where the items in the list
are unsorted.
Requirements:
Define a list and develop a set of operations for creating and manipulating a list that satisfies the
list ADT specification.
List ADT Specification
Structure: The list elements are of ItemType. The list has a property called the current position
which designates the position of the last element accessed by GetNextItem during an iteration
through the list. Only ResetList and GetNextItem alter the current position.
Definitions (provided by the user):
MAX_ITEMS: A constant specifying the maximum capacity of items allowed on the list
Item Type: Class encapsulating the type of items in the list
RelationType: An enumeration type that consists of LESS, GREATER, EQUAL
Member function of ItemType that must be included:
RelationType ComparedTo(ItemType Item)
Function: Determines the ordering of two ItemType objects based on their keys
Precondition: Self and item have their key members initialized
Postcondition:
Function value = LESS if the key of self is less than the key of item
= GREATER if the key of self is greater than the key of item
= EQUAL if the keys are equal
Operations (provided by Unsorted List ADT)
Make Empty
Function: Initializes list to empty state
Preconditions: None
Postcondition: List is empty
Boolean IsFull
Function: Determines whether list is full
Preconditions: List has been initialized
Postcondition: Function value = (list is full)
int GetLength
Function: Determines the number of elements in list
Preconditions: List has been initialized
Postcondition: Function value = number of elements in list
ItemType GetItem(Item Typeitem, Boolean& found)
Function: Get list element whose key matches item’s key (if present)
Preconditions: List has been initialized
Key member of item is initialized
Postcondition: If there is an element someItem whose keymatches item’s key, then found =
true and copy of someItemis returned; otherwise found = false and item is returned
List is unchanged
PutItem(ItemType item)
Function: Puts item into list
Preconditions: List has been initialized
List is not full
Item is not in list
Postcondition: Item is in the list
DeleteItem(ItemType item)
Function: Deletes the element whose key matches item’s key
Preconditions: List has been initialized
Postcondition: One and only one element in list has a key matching item’s key
ResetList
Function: Initializes current p.
Please the following is the currency class of perious one- class Curre.pdfadmin463580
Please the following is the currency class of perious one.
class Currency {
protected:
int whole;
int fraction;
virtual std::string get_name() = 0;
public:
Currency() {
whole = 0;
fraction = 0;
}
Currency(double value) {
if (value < 0)
throw "Invalid value";
whole = int(value);
fraction = std::round(100 * (value - whole));
}
Currency(const Currency& curr) {
whole = curr.whole;
fraction = curr.fraction;
}
/* This algorithm gets the whole part or fractional part of the currency
Pre: whole, fraction - integer numbers
Post:
Return: whole or fraction
*/
int get_whole() { return whole; }
int get_fraction() { return fraction; }
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void set_whole(int w) {
if (w >= 0)
whole = w;
}
void set_fraction(int f) {
if (f >= 0 && f < 100)
fraction = f;
}
/* This algorithm adds an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void add(const Currency* curr) {
whole += curr->whole;
fraction += curr->fraction;
if (fraction > 100) {
whole++;
fraction %= 100;
}
}
/* This algorithm subtracts an object to the same currency
Pre: object (same currency)
Post:
Return:
*/
void subtract(const Currency* curr) {
if (!isGreater(*curr))
throw "Invalid Subtraction";
whole -= curr->whole;
if (fraction < curr->fraction) {
fraction = fraction + 100 - curr->fraction;
whole--;
}
else {
fraction -= curr->fraction;
}
}
/* This algorithm compares the an object of the same currency for equality or inequality
Pre: object (same currency)
Post:
Return: whole/fraction
*/
bool isEqual(const Currency& curr) {
return curr.whole == whole && curr.fraction == fraction;
}
/* This algorithm compares the an object of the same currency to determine which is greater or
smaller
Pre: object (same currency)
Post:
Return: true/false
*/
bool isGreater(const Currency& curr) {
if (whole < curr.whole)
return false;
if (whole == curr.whole && fraction < curr.fraction)
return false;
return true;
}
/* This algorithm prints the name and value of the currency object
Pre: value of whole, fraction, and the name
Post: whole, fraction, get_name()
Return:
*/
void print() {
std::cout << whole << "." << fraction << " " << get_name() << std::endl;
}
};
class Krone : public Currency {
protected:
/*
This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Krone
Post:
Return: name
*/
std::string name = "Krone";
std::string get_name() {
return name;
}
public:
Krone() : Currency() { }
Krone(double value) : Currency(value) { }
Krone(Krone& curr) : Currency(curr) { }
};
class Soum : public Currency {
protected:
/* This algorithm gets the name for the Currency.
Pre: name - declared as string and initialized as Soum
Post:
Return: name
*/
std::string name = "Soum";
std::string get_name() {
return name;
}
public:
Soum() : Currency() { }
Soum(double value) : Currency(value) { }
Soum(Krone& curr) : Currency(curr) { }
};
A LinkNode structure or class which will have two attrib.
please follow all instructions and answer the inbedded questions- and.pdfIan5L3Allanm
please follow all instructions and answer the inbedded questions, and written in C pls
// Write your name here
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switch (c)
{
case 'a'.
In java , I want you to implement a Data Structure known as a Doubly.pdfaromalcom
In java , I want you to implement a Data Structure known as a Doubly-Ended-Queue. it is a
“fair” data structure in that it implements a FIFO (First In First Out ) behavior. As such, it is
often used to implement various wait lists in computer systems. For example, jobs waiting to use
the CPU, jobs waiting for a printer, jobs waiting to be placed into RAM for execution. In short,
whenever we want a fair strategy for waiting we use queues.
A DEQUE (Doubly-ended-queue) is a related data structure. Although similar to a Queue, it
differs in that it allows for insertions AND deletions from either end of the list (both the front
and the rear).
Your implementation MUST use a doubly-linked-list implementation. You may not use a static
array implementation.
Thus, a Deque is a List but it is one which only concerns itself with the first and last positions for
any insertion or deletion. The 6 operations supported are :
public void insertFront( int item ) - insert the given item (as a node) into the first position of the
Deque.
public void insertRear( int item ) - insert the given item (as a node) into the last position of the
Deque.
public int deleteFront( ) - delete and return the element stored in the first node of the Deque.
public int deletRear( ) – delete and return the element stored in the last node of the Deque.
public boolean isempty( ) - returns true if the Deque is currently empty or false if it is not.
public void printDeque( ) - print the integers from the list, one per line, from the first element
through to the last in order.
Classes
Your program must implement the following 3 classes. public class dequeDriver
This class will contain your program’s main method. It will need to declare a deque object and
process input as indicated below.
Your program should prompt the user for the path of an input file. It should open the file for
input and process it line by line. Each line of the input file will have one of the following forms.
PR
IF
IR
DF
DR
The meanings of each input is as follows:
PR - print the current contents of the deque from front to rear using the printDeque( ) method of
the deque object.
IF - insert the given int value into the front of the deque.
IR - insert the given int value into the rear of the deque.
DF - delete the front value from the deque.
DR – delete the rear element of the deque.
Below is an example input file that your program should be able to process.
PR
IF 4
IF 5
IF 6
IR 7
PR
DR
PR
DF
PR
The output for the input file shown above is :
EMPTY DEQUE
----- Front -----
6
5
4
7
----- Rear -----
----- Front -----
6
5
4
----- Rear -----
----- Front -----
5
4
----- Rear -----
public class dequeNode
This class will implement the linked nodes that will be used to implement the deque itself.
It should have the following protected data members.
protected dequeNode next; // next pointer to next node
protected dequeNode prev; // previous pointer to previous node
protected int val; // the integer value stored within the dequeNod.
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
Getting Started
Create a class called Lab8. Use the same setup for setting up your class and main method as you
did for the previous assignments. Be sure to name your file Lab8.java. Additionally, make
another file called Arrays.java. This file will be an object, so simply start it off by declaring an
Arrays class. You can copy the following skeleton and fill in the appropriate code below each of
the comments:
public class Arrays {
/ Instance Variables
// Constructors
// findMin 1
// findMax
// calcSum
// calcAverage
// toString
}
Task Overview
Your task for this lab is to create a class called Arrays with some array processing methods. This
class will maintain an array and the number of elements present in it. Additionally, methods will
be available to display the current min and max elements along with the average of all of them.
Finally, a toString() method will be available to cleanly display all the array elements. Finally,
you will write a simple driver class to test out the above Arrays class.
Part 1: Instance Variables for Arrays
The first thing to do for the Arrays class is to set up its instance variables. Declare the following
(private) instance variables:
• An int array called array ? this will be the array we will be writing methods for.
• An int called count - this represents the number of valid elements in the array.
Part 2:
Constructors for Arrays The Arrays class will have two constructors. The first constructor takes
the maximum size of the array as input as a parameter and initializes the array instance variable
appropriately. It also sets count to size. Finally, it will initialize all of the array elements to some
values between 0 and 10, inclusive. To create this constructor, follow these steps:
• Import java.util.Random to make use of the random number generator.
• Create a constructor with the following header: public Arrays(int size)
• Initialize your array variable and set its size to size (see the chart on page 252 for reference on
initializing arrays). Be very careful that you are setting the value of your array instance variable,
as opposed to creating a new variable called array.
• Set the value of the count variable to size because we will be populating the entire array.
• Copy the following code to the constructor in order to generate random values between 0 and
10, inclusive:
Random rand = new Random();
for (int i = 0; i < count; i++)
{
array[i] = (rand.nextInt(10));
}
Next, create another constructor with the following header: public Arrays(int[] arr). This
constructor will initialize the class by using the passed arr argument in order to fill its instance
variables. The following things need to be done inside of this constructor:
• Set the array variable equal to arr.
• Set the count variable equal to the length of the array.
Part 3: Displaying the Output findMin()
The first method of this class will search the array for the minimum element. Copy the following
code for the findMin method. Note how the count i.
This is a java lab assignment. I have added the first part java re.pdffeetshoemart
This is a java lab assignment. I have added the first part \"java retail class\" at the bottom. I am
unsure how to read the txt file into an array from the retail class. The stock txt file has been
added also.
A beginning framework and inventory list has been provided to you to use your Retail Item Class
as an array. Develop a program to accomplish the following menu items that can be selected by
the end user. Discussion of what each menu item should do is provided below the menu item.
Modify your object class file as desired. Please append initials to files created. Use Select-Case
for menu choices and methods to perform those choices. Please make a selection: 1. Open
Inventory File (This should ask the user for the file name, open the file and load the data into the
object array). 2. Display All (This should show a table of all items and data) 3. Display Reorder
Only (This should show only the stock number, Description and current quantity for items
requiring reorder) 4. Find Stock number (Allows the user to enter part of the description and
displays all matching stock numbers and descriptions matching that - case insensitive, such as
“cubs” or “cubs”) 5. Display Stock number (Allows user to enter stock number and displays
record of item) 6. Add Quantity (Asks for stock number and quantity for units, adds it to current,
displays record results) 7. Subtract Quantity (Asks for stock number and quantity, subtracts,
displays results including if reorder is needed.) 8. Change Price (Asks for stick number, changes
price to provided value, display results). 9. New Item (Allows adding a new item, updates count.
Display record results). 10. Save Inventory File (asks user for file name, save all inventory to
that file in a format that can be read back.)
public class RetailItem{
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public void setUnitsOnHand(int userUnitsOnHand){
unitsOnHand=userUnitsOnHand;
}
public void setPrice(double userPrice){
price=userPrice;
}
public String getDescription(){
return description;
}
public int getUnitsOnHand(){
return unitsOnHand;
}
public double getPrice(){
return price;
}
public double getTotal(){
int total = unitsOnHand=(int) price;
return total;
}
public boolean getRestock(){
return false;
}
public RetailItem(String descriptionGiven, int unitsOnHandGiven, double priceGiven, int
restockGiven){
description=descriptionGiven;
unitsOnHand=unitsOnHandGiven;
price=priceGiven;
restock=restockGiven;
}
}
Solution
public class RetailItem{
private int stocknumber;
private String description;
private int unitsOnHand;
private double price;
private int restock;
public void setDescription(String userDescription){
description=userDescription;
}
public int getStocknumber() {
return stocknumber;
}
public void setStocknumber(int stocknumber) {
this.stocknumber = stocknumber;
}
public void setUnitsOnHand(in.
Introduction to objects and inputoutput Ahmad Idrees
Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
written in c- please answer the 4 questions and write the functions ba.pdfsravi07
written in c, please answer the 4 questions and write the functions based on the given code.
Thank you
// Write your name here
// Write the compiler used: Visual studio or gcc
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a linked list of game
items like you'd see in a folder.
// Each item has this information: item name, game name, type of item, item ID.
// The struct 'itemRecord' holds the information of one item. Variety is an enum.
// A linked list of structs called 'list' is declared to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use all string library functions.
// You will have to write your functions from scratch by looking at what is
expected to be passed into them in the pre-existing functions
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
struct itemRecord* next; // pointer to next node
};
struct itemRecord* list = NULL; // declare linked list
'list'
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already pre-implemented last homework
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation: add, sort, delete, load
// Implement your own headers.
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from file (if it exists).
Initially there will be no file.
char choice = 'i'; // initialized to a dummy value
do
{
printf("\nEnter your selection:\n");
printf("\t a: add a new item\n");
printf("\t d: display item list\n");
printf("\t r: remove a item from list\n");
printf("\t s: sort item list by ID\n");
printf("\t q: quit\n");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file (overwrites file if it
exists)
return 0;
}
// flush out leftover '\n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != '\n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int itemId_input, add_result = 0;
char itemtype_input[20];
switc.
Write a function which return a list of all of the n element subset .pdfhardjasonoco14599
Write a function which return a list of all of the n element subset of a given set
Implement in JAVA Question 3 Write a function that returns a list of all of the n-element subsets
of a given set. For example, if the given set is [1,2,3] and n is 2, then the returned list should
contain [1,2], [1,3], and [2,3]. The order of the elements is not important.
Solution
The program for this problem is as follows:
Comments are included in the program for explaining the steps.
A sample output is attached below the program.
package com.temp;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* Program to find sublists of a list.
* @author Rohit Phatak
*
*/
public class subset {
/**
* This list will contain the resultant sublists.
*/
static List list = new ArrayList<>();
public static void main(String arg[]){
/**
* Input a list comma separated.
*/
System.out.println(\"Enter a list : \");
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
String[] sArr = s.split(\",\");
/**
* Input a value of n.
*/
System.out.println(\"Enter value of n : \");
Integer n = scanner.nextInt();
/**
* Check if value of n is greater than entered list.
*/
if(sArr.length < n){
System.out.println(\"Length of list is less than value of n\");
} else if(sArr.length > 0){
getSubsetList(sArr,n);
System.out.println(\"List is as :\");
/**
* Printing the sublists.
*/
for(String[] str : list){
String printVar = \"\";
for(String temps : str)
printVar+=temps+\",\";
System.out.println(\"[\"+printVar.substring(0, printVar.length()-1)+\"]\");
}
} else {
System.out.println(\"Please enter atleast one element:\");
}
scanner.close();
}
/**
* This method calls the recursive function which is used to obtain the sublists.
* @param sArr
* @param n
* @return
*/
public static List getSubsetList(String[] sArr,Integer n){
List lista = new ArrayList<>();
sublist(sArr, 0, n, new String[n]);
return lista;
}
/**
* This is a recursive function.
* This function will iterate over itself for finding the sublist.
*
* Parameters are as follows:
*
* @param arr -> List entered by the user.
* @param n -> Value of sublist entered by user.
* @param startPosition -> index to start creating the sublist.
* @param result -> resultant sublist
*/
public static void sublist(String[] arr, int startPosition, int n, String[] result){
/**
* Check for the value of n ==0.
* If n==0 break from the recursion.
*/
if (n == 0){
/**
* Add the sublist \'result\' in the list.
*/
list.add(result.clone());
return;
}
/**
* Iterate through for loop starting from startPosition till length of list minus entered value
n.
*/
for (int i = startPosition; i <= arr.length-n; i++){
/**
* Here result is a temporary sublist.
* This for loop adds an element to the temporary sublist in each iteration.
* The element is added from the complete list entered by user.
* Location of element is iTh index.
*/
result[result.length - n] = arr[i];
/**
* After adding the element to the temporary sublist, the sublist an.
Change the code in Writer.java only to get it working. Must contain .pdfsecunderbadtirumalgi
Change the code in Writer.java only to get it working. Must contain methods: logReverse() ,
logMax(), logDuplicates(),
This lab is going to focus on File Output, which you will find is somewhat similar to console
output.
FileMain.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class FileMain {
public static void main(String[] args) throws IOException{
Scanner scnr = new Scanner(System.in);
System.out.print("Please enter the name of the file you would like to read: ");
String fileName = scnr.next();
Reader reader = new Reader();
ArrayList fileContents = reader.getFileContents(fileName);
System.out.println("Please enter a name for your new file: ");
String newFileName = scnr.next();
Writer fileOut = new Writer(newFileName);
fileOut.logReverse(fileContents);
fileOut.logMax(fileContents);
fileOut.logDuplicates(fileContents);
fileOut.closeWriter();
scnr.close();
}
}
Filetester.java
import java.io.IOException;
import java.util.ArrayList;
public class FileTester {
public static boolean testLogReverse(ArrayList contents) throws IOException {
Writer writer = new Writer("logReverseTest.txt");
writer.logReverse(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("Reversed file contents: ");
expected.add("58");
expected.add("12");
expected.add("19");
expected.add("42");
expected.add("12");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logReverseTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static boolean testLogMax(ArrayList contents) throws IOException {
Writer writer = new Writer("logMaxTest.txt");
writer.logMax(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("The largest number in the file is: 58");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logMaxTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static boolean testLogDuplicates(ArrayList contents) throws IOException {
Writer writer = new Writer("logDuplicatesTest.txt");
writer.logDuplicates(contents);
writer.closeWriter();
ArrayList expected = new ArrayList();
expected.add("Duplicates found: true");
expected.add("End of file.");
Reader testReader = new Reader();
ArrayList result = testReader.getFileContents("logDuplicatesTest.txt");
if(expected.equals(result)) return true;
else return false;
}
public static void main(String[] args) throws IOException {
Reader reader = new Reader();
ArrayList fileContents = reader.getFileContents("nums.txt");
System.out.println("logReverse test passed? " + testLogReverse(fileContents));
System.out.println("logMax test passed? " + testLogMax(fileContents));
System.out.println("logDuplicates test passed? " + testLogDuplicates(fileContents));
}
}
Reader.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Sca.
Sorted number list implementation with linked listsStep 1 Inspec.pdfalmaniaeyewear
Sorted number list implementation with linked lists
Step 1: Inspect the Node.java file
Inspect the class declaration for a doubly-linked list node in Node.java. Access Node.java by
clicking on the orange arrow next to LabProgram.java at the top of the coding window. The
Node class has three fields:
a double data value,
a reference to the next node, and
a reference to the previous node.
Each field is protected. So code outside of the class must use the provided getter and setter
methods to get or set a field.
Node.java is read only, since no changes are required.
Step 2: Implement the insert() method
A class for a sorted, doubly-linked list is declared in SortedNumberList.java. Implement the
SortedNumberList class's insert() method. The method must create a new node with the
parameter value, then insert the node into the proper sorted position in the linked list. Ex:
Suppose a SortedNumberList's current list is 23 47.25 86, then insert(33.5) is called. A new
node with data value 33.5 is created and inserted between 23 and 47.25, thus preserving the list's
sorted order and yielding: 23 35.5 47.25 86
Step 3: Test in develop mode
Code in main() takes a space-separated list of numbers and inserts each into a SortedNumberList.
The list is displayed after each insertion. Ex: If input is
then output is:
Try various program inputs, ensuring that each outputs a sorted list.
Step 4: Implement the remove() method
Implement the SortedNumberList class's remove() method. The method takes a parameter for the
number to be removed from the list. If the number does not exist in the list, the list is not
changed and false is returned. Otherwise, the first instance of the number is removed from the
list and true is returned.
Uncomment the commented-out part in main() that reads a second input line and removes
numbers from the list. Test in develop mode to ensure that insertion and removal both work
properly, then submit code for grading. Ex: If input is
then output is:
Given templates:
LabProgram.java
import java.util.Scanner;
import java.io.PrintWriter;
public class LabProgram {
// Prints the SortedNumberList's contents, in order from head to tail
public static void printList(SortedNumberList list) {
Node node = list.head;
while (null != node) {
System.out.print(node.getData() + " ");
node = node.getNext();
}
System.out.println();
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
String inputLine;
// Read the line of input numbers
inputLine = scnr.nextLine();
// Split on space character
String[] terms = inputLine.split(" ");
// Insert each value and show the sorted list's contents after each insertion
SortedNumberList list = new SortedNumberList();
for (Object term : terms) {
double number = Double.parseDouble(term.toString());
System.out.println("List after inserting " + number + ": ");
list.insert(number);
printList(list);
}
/*
// Read the input line with numbers to remove
inputLine = scnr.nextLine();
terms = inputLine.split(" ".
Exercise 1 (10 Points) Define a FixdLenStringList class that encaps.pdffms12345
EX 25-15 Decision on accepting additional business Brightstone Tire and Rubber Company has
capacity to produce 170,000 tires. Brightstone presently produces and sells 130,000 tires for the
North American market at a price of $175 per tire. Brightstone is evaluating a special order from
a European automobile com- pany, Euro Motors. Euro is offering to buy 20,000 tires for $116
per tire. Brightstone\'s accounting system indicates that the total cost per tire is as follows: OBJ.
1 $ 56 Direct materials Direct labor Factory overhead (60% variable) Selling and administrative
expenses (45% variable) Total 25 26 $129 Brightstone pays a selling commission equal to 5% of
the selling price on North Ameri- can orders, which is included in the variable portion of the
selling and administrative expenses. However, this special order would not have a sales
commission. If the order was accepted, the tires would be shipped overseas for an additional
shipping cost of $7.50 per tire. In addition, Euro has made the order conditional on receiving
European safety certification. Brightstone estimates that this certification would cost $165,000.
a. Prepare a differential analysis dated January 21 on whether to reject (Alternative 1) or accept
(Alternative 2) the special order from Euro Motors. b. What is the minimum price per unit that
would be financially acceptable to Brightstone?
Solution
1.
2.Differential AnalysisReject Order (Alt. 1) or Accept Order (Alt.2)January 21Reject
OrderAccept OrderDifferential Effect on Income(Alternative 1)(Alternative 2)(Alternative
2)Revenues 22,750,000 25,070,000
2,320,000(130000*175)(130000*175)+(20000*116)CostsDirect Materials
7,280,000 8,400,000 1,120,000(130000*56)(150000*56)Direct
Labor 2,860,000 3,300,000
440,000(130000*22)(150000*22)Variable Factory Overhead 1,950,000
2,250,000 300,000(60% of
25)(130000*60%*25)(150000*60%*25)Variable Selling and Admin Expenses15210001580000
59,000(45% of 26)(130000*45%*26)(130000*45%*26)+(20000*2.95Shipping cost
- 150,000
150,000(20000*7.5)Certification cost -
165,000 165,000Income (Loss) 9,139,000
9,225,000 86,000Bright stone should accept the special order from Euro Motors.
Describe the procedure you would use in the laboratory to determine .pdffms12345
Describe how relational databases are used in OLAP analysis, data mining, and E-commerce
website applications.
Solution
Relational DataBase Management System used for OLTP Database Systems:
OLAP with relational data base called ROLAP ROLAP works directly with relational databases
management system. The base data and the dimension tables are stored as relations and new
relations are created to hold the aggregated data. It depends on a specialized design schema. This
methodology relies on manipulating the information stored in the relational database to give the
appearance of traditional OLAP\'s slicing and dicing functionality.
When Data mining use RDBMS(Relational DataBase Management System) We called
Relational data mining Data mining algorithms look for patterns in information. Relational data
mining (RDM) scheams are based on inductive logic programming , find patterns that involve
relation tables from a relational database.
Ecommerce entrepreneurs: It use relational databases work business decisions
Selecting shopping cart software and hiring one web developer over another..
CHEM 1011 Discussion question 2ObjectiveTo learn more about the .pdffms12345
Chapter 3, Testbank, Question 23 Leon Royal Hotel was the first inn in the county of Belvore. It
had started out as a small investment with seven rooms, providing bed and breakfast in 1949 to
many travelers who came to Belvore. Another inn called Meltown Inn started out a decade after
Leon Royal Hotel. After 20 years of giving unique and satisfying service to its customers, Leon
Royal Hotels was well established as a large hotel with more than 1,500 rooms. The facilities and
services provided by the hotel made it one of the best hotels in the Belvore, while Meltown Inn
started losing profits and eventually shut down in 1968 because of providing bad service. Which
of the following factors of inimitability is explained in this scenario? Tacit knowledge Path
dependence Casual ambiguity Complexity
Solution
D. Complexity
how ?
Tacit knowledge is having a knowledge that can\'t be passed down or transferred by verbal or
written communication like how to speak languages etc.
Path dependence is role of historical events and opportunities .
Casual ambiguity is when the relationship between a resource and it\'s application or use can\'t be
understood.
Complexity is highly inimitable because social relations and relationships with customers can\'t
be imitated.
Since the statement is about complexity as unique and service offered by Leon royal hotel
couldn\'t be copied,option D is the answer ..
Could you implement this please. I was told to use pointers as the d.pdffms12345
Costs and MC The figure to the right shows short-run cost and demand curves for a
monopolistically competitive firm in the footwear market. revenue ATC AVC P. Which of the
following statements describes the best course of action for the firm depicted in the diagram?
The firm should minimize its losses by producing o, units and charging a price of Po The firm
should exit the industry because its price is less than its average total cost The firm should
minimize its losses by producing O A. Demand O B. MA O C. Quantity , units and charging a
price of 2 The firm should minimize its losses by producing Q, units and charging a price of P1
O D. Click to select your answer
Solution
A monopolistically competitive firm maximizes profit or minimizes loss when it produce that
level of output corresponding to which MR curve intersects MC curve.
The given figure shows that MR curve is intersecting MC curve corresponding to QY level of
output.
Corresponding to this level of output, Price is P1, ATC is P2, and AVC is P0.
Since, price is less than ATC, firm is incurring a loss.
However, price is greater than AVC.
So,
Best course of action for firm in short-run is to remain in operation and minimize its losses by
producing QY units and charging a price of P1.
Hence, the correct answer is the option (D)..
A piece of malware is running on a Windows 7 machine via process inj.pdffms12345
A person who decides to buy or sell securities based on publicly available information and
analysts is called a(n) trader block public Informed Inside Normal
Solution
The informed trader uses the extraneous information source to seek statistical arbitrage
opportunities, while at the same time accommodating the additional risk. The amount of
information available to the general market participant concerning the asset return is measured
by the mutual information of the asset price and the associated cash flow. The worth of the
additional information source is then measured in terms of the difference of mutual information
between the general market participant and the informed trader. This difference is shown to be
nonnegative when the signal-to-noise ratio of the information flow is known in advance. Explicit
trading strategies leading to statistical arbitrage opportunities, taking advantage of the additional
information, are constructed, illustrating how excess information can be translated into profit.
Company names Aerial Drones Surveillance Inc. Your company descript.pdffms12345
Client / Server using named pipes with threads and fork() in C/C++
**Note** You will need to write a client program and a server program for this question to be
correct. **
**Cannot use socket**
client
the client application that will get the command from the user and pass the command to be
executed from the command line, parses the command and puts a binary representation of the
parse into a shared memory segment. At this point, the client will listen on the read size of a
named pipe to get the output from the command. Display this information on standard output.
server
the server application will listen for requests from clients in shared memory, process these
requests when it receives them from the client, and return data back to the client over the
connection. The server must be able to handle multiple connections at the same time.
The client and server need to communicate with each other using shared memory and named
pipes. For each new request in shared memory, the server should start up a new thread. This
thread will need to start a new thread for each command; this thread will need to use fork() and
exec() to launch the new process for the command to be executed. You will need to keep track of
which client has started the connection (the contents of the shared memory will need to include
an indication of which client started the process).
Client / Server using named pipes with threads and fork() in C/C++
**Note** You will need to write a client program and a server program for this question to be
correct. **
**Cannot use socket**
client
the client application that will get the command from the user and pass the command to be
executed from the command line, parses the command and puts a binary representation of the
parse into a shared memory segment. At this point, the client will listen on the read size of a
named pipe to get the output from the command. Display this information on standard output.
server
the server application will listen for requests from clients in shared memory, process these
requests when it receives them from the client, and return data back to the client over the
connection. The server must be able to handle multiple connections at the same time.
The client and server need to communicate with each other using shared memory and named
pipes. For each new request in shared memory, the server should start up a new thread. This
thread will need to start a new thread for each command; this thread will need to use fork() and
exec() to launch the new process for the command to be executed. You will need to keep track of
which client has started the connection (the contents of the shared memory will need to include
an indication of which client started the process).
Client / Server using named pipes with threads and fork() in C/C++
**Note** You will need to write a client program and a server program for this question to be
correct. **
**Cannot use socket**
client
the client application that will get the command from th.
2. The Lorenz curve measures inequality in person income distribution.pdffms12345
2. (15 points) For the tal For the rational functions below, find all zeros, holes, vertical
asymptotes, and the long-run havior. If the function does not have a vertical asymptote or hole
please indicate so. (a) f(1) = Zeros: Vertical Asymptotes: Holes: Long-Run Behavior: (x+1)(x +
3) (b) f(x) =- - 4x(+ 3) Zeros: Vertical Asymptotes: Holes: Long-Run Behavior:
Solution
a) f(x) = ( x^2 - 9 ) / x^3
zeros are
x^2 - 9 = 0
x^2 = 9
x = + - 3
zeros ( 3,0) and (-3,0)
vertical asymptotes are
x = 0
holes - none
long run behaviour
f(x) = x^2 / x^3 = 1/x
so , as x tends to + - infinity f(x) will tend to 1/x
b) f(x) = ( x+1)^2 ( x+3) / - 4x ( x+3)
zeros are
( x+1)^2 = 0
x = -1
zero is (-1,0)
vertical asymptotes are
x = 0
holes are x = -3
long run behaviour f(x) = x^3 / -4x^2
f(x) = -x /4
the graph will behave like f(x) = -x/4 for larger values.
13 808 PM docs.google.com Covalent Bonding and lonic Bonding study.pdffms12345
10. Identify and discuss the goods oriented remedies of the seller and the buyer 11. ldentify and
discuss the moncy oriented damages of the seller and the buyer 12 identify and discuss the
\"specific performance\" remedies of the seller and buyer.
Solution
Q. 10) Goods oriented remedies of a buyer are as follows
1) When seller became insolvent and buyer wants to recover the goods purchased
In this case , When seller has paid first installment of proice so now he has booked special
property interest in the identified good and seller became insolvent within 10 days following first
receipt of price then to get the good from seller , buyer needs to pay remaining portion of price
and get the product.
2) To sue the buyer.
In this case , when seller is unlawfully not ready to give the product to buyer as buyer has paid in
full price of goods then buyer can sue him.
3) Buyer can enforce security interest in goods
in this case , remedy shall be when buyer fully rejects but he has the product with himself then
buyer has security interest to the extent of any expenses incurred by buyer .
Buyer shall sell the goods and pay the proceeds to seller above the security interest.
Goods oriented remedies of seller are as follows:
1) When buyer breaches
In this case , seller can withhold the delivery of remaining goods
2) When seller comes to know that buyer has become insolvent
In this case , seller will stop the delivery of goods till the time goods are in transit.
3) When buyer breaches and goods are in process
in this case , seller shall stop the production and unfinished goods shall be sold as scrap so the
damages of seller can be recovered
Q 11) Money oriented remedies of buyer are as follows
1) When seller breaches regarding payment made
in this case , buyer should recover as much price he has already paid and then return the goods.
2) when seller breaches then buyer should cover
in this case , buyer can buy substitute while acting in good faith and then try to cover the
expenses incurred. If buyer doesnt cover then he will not be able to cover his damages
3) When seller breaches then buyer needs to cover damages for non delivery
in this case , damages = (contract price -market price ) + expenses incurred.
Money oriented remedies of seller are as follows
1) When buyer breaches then
in this case , seller shall resell the goods to recover damages in good faith and evn seller may
give notice to buyer for breach of contract
2) When buyer breaches regarding non acceptance of goods
in this case , seller shall recover damages as the difference between the market price and place of
sell plus any expenses incurred.
3) When buyer breaches regarding price to be paid
in this case , seller shall recover the price by conforming goods are lost and damaged after risk of
loss is transfered to buyer
Specific performance remedies of the buyer are as follows
1) When seller breaches then buyer may cancel
in this case , buyer can cancel by repudiating the contract.
2) when sel.
1.The shrimping industry needs female shrimp for production purposes.pdffms12345
1.2 Briefly describe the traffic, services, and hardware trends in business networks.
Double space your paper
-The paper must use APA format (6th edition)
-Minimum of 2 pages, excluding any cover page.
That is, the 2 pages must be content related.
Solution
Business networks are useful and they help to manage the locations that are geographically
dispersed. It helps the organizations to deliver information for workers in an effective manner. It
helps for improving communication and helps in the process of information management
between various business organizations.
It helps to bring the The business partners together and helps in improving efficiency, agility and
effective innovation.
Traffic growth
It does not have its limitations anymore only with voice and data. It has strong business focus on
web service, remote access, effective online transactions and services of social networking.
Services are effectively expanding and there is a strong data traffic due to the smart phones and
tablets. There exists high demand for excellent high resolution, cameras, audio and video.
Hardware has excellent computers and supportive function with demand applications. The
networks have become intelligent and there has been boom in Internet and web. There is
increased in improved intranets and extranets..
Who are the stakeholders in an income statement and whySolution.pdffms12345
Which of the following would act as a nonelectrolyte when dissolved in water? Select all that
apply.
a. NH4NO3
b. NaCl
c. CH3OH
d. K2CrO4
e. C6H12O6
Solution
The answer is: (c) and (e)
CH3OH and C6H12O6 are molecular compounds and do not ionize in water. Thus they are
nonelectrolytes.
All the others are soluble ionic compounds that will ionize in water and are thus electrolytes:
NH4NO3 => NH4+ + NO3-
NaCl => Na+ + Cl-
K2CrO4 => 2 K+ + CrO42-.
Which company maintains natural habitats while B allowing us to live .pdffms12345
When multiple strains of the same bacterial species are sequenced, what are the features of their
genome that are typically observed?
Solution
Multiple strains of the same bacterial species features:
The sequencing of multiple strains from the same bacterial species has clearly demonstrated that
horizontal gene transfer accounts for the majority of intraspecies genome differences.
Comparative analysis of these bacterial sequences has revealed the movement of phage DNA by
lateral transfer as having significant impact on the evolution of the host genome.
Escherichia coli is an important component of the biosphere and is an ideal model for studies of
processes involved in bacterial genome evolution. The diversity within the species E. coli, and
the overlap in gene content between this and related species, suggests a continuum rather than
sharp species borders in this group of Enterobacteriaceae..
When multiple strains of the same bacterial species are sequenced, w.pdffms12345
What would you consider to be a successful information system implementation? In 3-to-5
sentences. Why.
Solution
System implementation attempts offer strange challenges to information technology experts and
the Organizations impacted by the implementations.
A winning implementation can reap huge rewards in Organizational forces and efficiencies. A
breakdown can use up an association of people, funds and vitality.
As a result, many populaces have puzzled over the reasons for the achievements and failures
knowledgeable with these Implementations.
This paper inspects these puzzling as presented through scholarly investigate and first-hand
accounts of system implementations in institutions of higher culture and discovers that many
responds lie outside the limits of technology..
What specialized cells line the inner cavity and move fluids through.pdffms12345
What is Wolff’s Law and why is it important to the design of biomaterials for skeletal repair and
regeneration?
Solution
Wolff\'a law was proposed by German surgeon Jullies Wolff. According to this law bone in an
healthy person adapts to forces and stresses on which it is placed.
If loading on a particular bone increases, the bone will remodel itself over time to become
stronger to resist that sort of loading. The racquet-holding arm bones of tennis players become
much stronger than those of the other arm. Their bodies have strengthened the bones in their
racquet-holding arm since it is routinely placed under higher than normal stresses.
This law is important in the designing of biomaterials because it helps us understand
phenomenon of bone remodelling and how bone adjusts to different types of forces
Bone constantly undergoes the process of remodeling. This process consists of two stages:
resorption and formation. During resorption, old bone tissue is broken down and removed by
special cells called osteoclasts. Once this has been done, bone formation begins and new bone
tissue is laid down to replace the old. This task is performed by special cells called osteoblasts.
Osteoblasts produce collagen, enzymes, and other proteins that make up the organic portion of
the bone matrix.”
It is important for the bone to access the information ,where the areas of stress are going to be so
that bone can remodel and strengthen in preparation for the event. Bone cells, in particular
osteocytes, are extremely sensitive to mechanical stress.
Wolff law helps us to design biomaterials according to the stress it will undergo in the body..
What does the metaphor meaning for the Iron curtainSolutionIr.pdffms12345
What budgetary reform changes (federal, state, or local) would you make if you were
empowered to do so?
Solution
Governments pursue budget reform for many reasons. If government spending is greater than the
amount of money the government takes in with taxes, reform may be necessary to balance the
budget and control government debt..
For controlling expenditure and finding new sources of income reforms have been made by
government..
So reforms have been needed to change the structure of government budget however federal
government has to ensure that all needs have been fulfilled withing country ,whether it is in
particular state or local area..
So federal reforms have been more important from whole country point of view...if balance can
be established on that area than reforms can be successfully implemented,
So federal reforms is more important and I will have such authority than I wiil chose federal
reforms...
What are the major developmental milestones between infancy and todd.pdffms12345
What are Texans’ attitudes on the death penalty in relation to those of the rest of the country, and
why do they differ? Next, do some research and discuss the number of executions in Texas since
the mid-1970s when compared to the rest of the country. Follow this up with additional research
to determine the number of death penalty case exonerations in Texas when compared to the rest
of the country. Report your findings and does this change your perspective on the death penalty
in Texas? When responding to this question, be sure to reference course materials to support
your response, conclusions, and opinions. Your response for this question should be 250 words.
Solution
Capital punishment is abolished almost everywhere in the globe except few countries and few
states in the U.S. There are few things to be considered in favor of abolishing capital
punishment. Firstly, it is inhuman in this civilized and digital society where even life of the
animals is respected more. Secondly, the cost of trial and execution is much more than a life
sentence trial. Thirdly, the post traumatic stress that the family members of the executed will
experience and finally, the wrong convictions means innocents are punished. Once a death
penalty is executed and later when the person is proved innocent, no one can bring the life back.
The states should look for opportunities to prevent such crimes right from the school days by
identifying trouble makers and counseling them appropriately rather than keep killing people.
It’s true that punishments reduce crime but there is no proof that capital punishment has reduced
crime considerably..
Using the Web or another research tool, search for alternative means.pdffms12345
Using namespace std;
The expansion of a steel bridge as it heated to a final Celsius temperature, Tf, from an initial
temperature T0 , can be approximated using the following formula:
Increase in length= a* L*(Tf-T0). Where a is the coefficient of expansion that is for steel is
11.7e-6, L is the length of bridge at temperature T0.
Using this formula, write a C++ program that displays a table of expansion length for a steel
bridge that’s 7365 meters long at 0 degrees Celsius, as the temperature increases to 40 degrees in
5 degree increments.
Solution
#include
using namespace std;
float Length(int Tf)
{
const float a = 11.7E-6;
const float L = 7365;
const float To=0;
return a*L*(Tf-To);
}
int main(int argc, char const *argv[])
{
cout<<\"Intitial Temperature\\tFinal Temperature\\tIncreased Length\ \";
for (int i=1;i<=8;i++)
cout<<0<<\" degrees\\t\\t\"<.
TV Guide magazine ran a cover photo for a story emphasizing Oprah Wi.pdffms12345
Trend of thinner beauty pageant winners has generated charges that the contest encourages
unhealthy diet habits among young women Listed below are body indexes (BMI) for beauty
pageant winners from two different time periods. Find the coefficient of variation for each of the
two sets of data, then compare the coefficient of venation for the BMI\'s of beauty pageant
winners from the 1920s and 1930s is % round to one decimal place as needed.)
Solution
Dear Student Thank you for usng Chegg !! Given Mean = (Sum of
Values) / No of values Deviations = Values - Mean Variance = (Sum of square of
deviations /no of deviations) Standard deviation (SD) = Square root of variance
Coefficient of variation = Standard deviation / Mean BMI (B/w 1920 ~1930)
Mean Deviations from mean Square (Deviations) Variance SD Coeff Of Variation BMI (From
Recent Winners) Mean Deviations from mean Square (Deviations) Variance SD Coeff Of
Variation 20.4 20.16 0.24 0.0576 1.9324 1.390108 0.068953765 19.5 18.76 0.74 0.5476 1.3004
1.140351 0.060786291 21.9 1.74 3.0276 20.3 1.54 2.3716 22.1 1.94 3.7636 19.5 0.74 0.5476
22.3 2.14 4.5796 20.2 1.44 2.0736 20.2 0.04 0.0016 17.8 -0.96 0.9216 18.8 -1.36 1.8496 17.9 -
0.86 0.7396 18.9 -1.26 1.5876 19.2 0.44 0.1936 19.4 -0.76 0.5776 18.9 0.14 0.0196 18.5 -
1.66 2.7556 17.6 -1.16 1.3456 19.1 -1.06 1.1236 16.7 -2.06 4.2436
Comparing the two Coefficient of variation 1920~1930 = 0.068953765 Recent =
0.060786291 Solved.
Tim Tassopoulos, the chief operating officer for Chick-Fll-A applies .pdffms12345
This question has been posted but the answer given on this site leaves an error when compiling
\"No suitable method found for println(java.lang.String,)
My question is for Java as follows. Create a program that has an array of length 100 which will
automatically be filled with randomly generated numbers between 1 and 100 each time the
program is run. Have the program ask the user to enter a number between 1 and 100. Check to
see if that number is one of the values in the array. If it is display “We found your number XX at
position YY in the array” If the number is not in the array tell the user that no match was found.
The following is what I have so far, please advise what needs corrected to make this work for
Java
import java.util.*;
import java.lang.*;
import java.io.*;
class Search
{
public static void main (String[] args) throws java.lang.Exception
{
int[] array;
for (int i = 0; i < 100; i++)
{
array[i] = 1 + (int)(Math.random() * 100);
}
Scanner sc=new Scanner(System.in);
System.out.println(\"Enter number between 1 and 100\");
int number=sc.nextInt();
for (int i = 0; i < 100; i++)
{
if (array[i] == number)
{
System.out.println(\"We found your number \" , number, \" at position \", i, \" in the array\");
}
else
{
System.out.println(\"no match was found\");
break;
}
}
}
}
Solution
Hey, I got your mistake.It\'s the else part in the if-else condition. What\'s happening is that if
even for the first number if the condition fails;the control is shifting to else block and as in else
block you have applied break;the control is getting out of loop.So,actually the loop is continuing
till the first unequal number only;but not for complete array
So,I am now re-writing your code.Your idea is correct.It was just small mistake.
The Hydrolysis of the Hydrated Pb ion PboH (aq) + H200SolutionP.pdffms12345
The heights(in feet) at timet(in seconds) of a silver dollar dropped from the top of the a
monument is given by the following expression.
Solution
s(t) = -16t^2 + 547
(a) s(2) = 483 m
s(3) = 403 m
Average velocity for [2,3] = 403 - 483 = -80 m/s
b) s\'(2) = 547 - 32t = 483 m/s
s\'(3) = 547 - 32(3) = 451 m/s
c) t = sqrt(547/16) = 5.847 s
d) s\'(5.847) = 359.896 m/s.
1. CDOs are normally divided into tranches. Holders of this tranche .pdffms12345
1)What is the exact mathematical relationship between the width of a confidence interval and the
Maximum Error of Estimate?
2)In your own words, describe the relationship between the standard error and maximum error.
You may use the formulas for each in your explanation.
1)What is the exact mathematical relationship between the width of a confidence interval and the
Maximum Error of Estimate?
2)In your own words, describe the relationship between the standard error and maximum error.
You may use the formulas for each in your explanation.
1)What is the exact mathematical relationship between the width of a confidence interval and the
Maximum Error of Estimate?
2)In your own words, describe the relationship between the standard error and maximum error.
You may use the formulas for each in your explanation.
Solution
1) Maximum Error of Estimate is half of width of confidence interval.
Maximum Error = (1/2)*(Width of confidence interval)
2) Standard Error is equal to Standard Deviation, however, Maximum Error is equal to Standard
Deviation multiplied by Z-score.
Therefore,
Maximum Error = z*(Standard Error).
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
The French Revolution Class 9 Study Material pdf free download
Using Array Approach, Linked List approach, and Delete Byte Approach.pdf
1. Using Array Approach, Linked List approach, and Delete Byte Approach: (add code for all three
approaches) (different classes preffered)
I am adding the sample program that you can use and modify, and add code to it.
You need to create a program that reads the input file (items.txt), and store the items in the file in
the Item array as well as the Array List. After creating that array, send the output records from
the file to a new file "ex1out1.txt"
Now, according to "p2changes.txt", you need to add or delete the record specified ( A or a: add
D or d: delete)
items.txt:
items.txt:
p2changes.txt:
A, 106,ChainSaw 12"
D,102
d,104
a,107,ChainSaw 10"
Sample program: (Sample program does input output files and array outputting which is
required)
Main:
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Main {
private static void step1() {
// Creating an array and an array list itemArray and itemArrayList
List itemArray = new ArrayList<>(10);
List itemArrayList = new ArrayList<>();
try {
//reading from file "items.txt"
BufferedReader reader = new BufferedReader(new InputStreamReader(new
FileInputStream("C:/Users/patel/Desktop/items.txt")));
String line = reader.readLine();
2. while (line != null) {
//splitting file by comma
String[] array = line.split(",");
Item item = new Item(Integer.parseInt(array[0]),array[1]);
itemArray.add(item);
itemArrayList.add(item);
line = reader.readLine();
}
//opening file for output
PrintWriter writer = new PrintWriter("C:/Users/patel/Desktop/ex1out1.txt");
writer.println("Aashiv " + " Patel");
//sorting in reverse order
Collections.sort(itemArray, new Comparator() {
@Override
public int compare(Item o1, Item o2) {
return o2.getItemNumber() - o1.getItemNumber();
}
});
// moving through the ArrayList and printing the items
writer.println();
writer.print("Array Format: ");
writer.println();
for(Item item : itemArray) {
writer.println();
writer.println(item);
}
//sorting in sequential order of numbers
Collections.sort(itemArrayList, new Comparator() {
@Override
public int compare(Item item1, Item item2) {
return item1.getItemNumber() - item2.getItemNumber();
}
3. });
// moving through the ArrayList and printing the items
writer.println();
writer.print("Array List Format: ");
writer.println();
for(Item item : itemArrayList) {
writer.println();
writer.println(item);
}
//closing both writers and readers
writer.close();
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
// Main method to call the step1 method
public static void main(String args[]) {
step1();
}
}
Item.java:
public class Item {
private int itemNumber; //number of item
private String itemName; //name of item
Item(int number, String name)
{
this.itemNumber = number;
this.itemName = name;
}
4. //return the artistName
public String getItemName() {
return itemName;
}
//set the artistName
public void set(int itemNumber, String itemName) {
this.itemName = itemName;
this.itemNumber = itemNumber;
}
//return the artistId
public int getItemNumber() {
return itemNumber;
}
// toString method
public String toString() {
return this.itemNumber + "," + this.itemName;
}
}
Solution
//In this code all changes from p2changes.txt file are made on ex1out1.txt and ex1out2.txt files.
//Item.txt file contains original contents.
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Main
{
private static List itemArray = new ArrayList<>(10);
private static List itemArrayList = new ArrayList<>();
private static void writeFile()
{
//opening file for output
5. try
{
PrintWriter writer = new PrintWriter("./ex1out1.txt");
PrintWriter writer2=new PrintWriter("./ex1out2.txt");
//sorting in reverse order
Collections.sort(itemArray, new Comparator()
{
@Override
public int compare(Item o1, Item o2)
{
return o2.getItemNumber() - o1.getItemNumber();
}
});
writer.println("Array Format :");
System.out.println("Array Format :");
for(Item item : itemArray)
{
System.out.println(item);
writer.println(item);
}
//sorting in sequential order of numbers
Collections.sort(itemArrayList, new Comparator()
{
@Override
public int compare(Item item1, Item item2)
{
return item1.getItemNumber() - item2.getItemNumber();
}
});
// moving through the ArrayList and printing the items
writer2.println("Array List Format: ");
System.out.println("Array List Format:");
for(Item item : itemArrayList)
{
System.out.println(item);
writer2.println(item);
6. }
//closing both writers and readers
writer.close();
writer2.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private static void step1()
{
// Creating an array and an array list itemArray and itemArrayList
try
{
//reading from file "items.txt"
BufferedReader reader = new BufferedReader(new InputStreamReader(new
FileInputStream("./items.txt")));
String line = reader.readLine();
while (line != null)
{
//splitting file by comma
String[] array = line.split(",");
Item item = new Item(Integer.parseInt(array[0]),array[1]);
itemArray.add(item);
itemArrayList.add(item);
line = reader.readLine();
}
System.out.println("Before making changes content of files ex1out1 and ext1out2
files");
writeFile();
System.out.println("==============");
reader.close();
}
catch (FileNotFoundException e)
{
7. e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static void step2()
{
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(new
FileInputStream("./p2changes.txt")));
String line = reader.readLine();
while (line != null)
{
//splitting file by comma
String[] array = line.split(",");
//checking the string of whether it is for adding new item or deleting an item
if(array[0].equals("A") || array[0].equals("a"))
{
Item item = new Item(Integer.parseInt(array[1]),array[2]);
itemArray.add(item);
itemArrayList.add(item);
}
else if(array[0].equals("D") || array[0].equals("d"))
{
//iterating through array for finding an item to delete
for(Item item : itemArray)
{
if(item.getItemNumber()==Integer.parseInt(array[1]))
{
itemArray.remove(item);
itemArrayList.remove(item);
break;
}
8. }
}
line = reader.readLine();
}
System.out.println("After making changes as in file p2changes.txt ====");
writeFile();
reader.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
// Main method to call the step1 method
public static void main(String args[])
{
step1();
step2();
}
}
//ex1out2.txt
Array List Format:
101,Nail #1
103,Nail #3
105,Hammer Large
106,ChainSaw 12"
107,ChainSaw 10"
//ex1out1.txt
Array Format :
107,ChainSaw 10"
106,ChainSaw 12"
105,Hammer Large
103,Nail #3
101,Nail #1
//p2changes.txt