You are to write a GUI program that will allow a user to buy, sell and view stocks in a stock
portfolio.
Objective:
Write a GUI program that maintains a cash balance, list of stock holdings, supports buying and
selling of stocks and displays the current portfolio inventory.
Program Capabilities:
1. Allow a user to buy a stock with a given number of shares and price per share.
2. Display the current portfolio (stock ticker, number of shares, initial price).
3. Update the portfolio display for purchases and sales.
4. Allow the user to sell all of the shares of a given stock.
5. Give the user an initial cash balance, and update and display the balance according to the
user\'s purchases and sales.
6. Ignore any transaction that causes the cash position to go below $0.
USE OF PREVIOUS StockHolding and PortfolioList LABS IS ADVISED. (I\'ve including my
solutions to these below)
This is my written code from earlier homework:
public class StockHolding {
private String ticker;
private int numShares;
private double initialSharePrice;
private double currentSharePrice;
public StockHolding(String ticker, int numberShares, double initialPrice) {
this.ticker = ticker;
numShares = numberShares;
initialSharePrice = initialPrice;
currentSharePrice = initialPrice;
}
public double getCurrentValue() {
return numShares * getCurrentSharePrice();
}
public double getInitialCost() {
return numShares * getInitialSharePrice();
}
public double getCurrentProfit() {
return getCurrentValue() - getInitialCost();
}
public double getCurrentSharePrice() {
return currentSharePrice;
}
public void setCurrentSharePrice(double currentSharePrice) {
this.currentSharePrice = currentSharePrice;
}
public String getTicker() {
return ticker;
}
public int getShares() {
return numShares;
}
public double getInitialSharePrice() {
return initialSharePrice;
}
@Override
public String toString() {
return \"Stock \" + ticker + \", \" + numShares + \", shares bought at \"
+ initialSharePrice + \", current price \"
+ currentSharePrice;
}
}
AND
import java.util.ArrayList;
public class PortfolioList {
private ArrayList portfolio;
public PortfolioList() {
portfolio = new ArrayList();
}
public void add(StockHolding stock) {
portfolio.add(stock);
}
public StockHolding find(String ticker) {
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
return sh;
}
}
return null;
}
public void remove(String ticker) {
int pos = -1;
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
pos = i;
}
}
if (pos != -1) {
portfolio.remove(pos);
}
}
I\'ve been staring at this for two days, and I am lost. Please, any guidance/help would be greatly
appreciated.
Honestly don\'t even need a full solution, just need something to kick start. A comment skeleton
would help a ton. Thanks!
Solution
SOURCE CODE:
package stock;
public class StockHolding {
private String ticker;
private int numShares;
private do.
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docxmelbruce90096
Week 2 iLab
TCO 2 — Given a simple problem, design a solution algorithm that uses arithmetic expressions and built-in functions.
Scenario
Your goal is to solve the following simple programming exercise. You have been contracted by a local antique store to design an algorithm determining the total purchases and sales tax. According to the store owner, the user will need to see the subtotal, the sales tax amount, and the total purchase amount. A customer is purchasing four items from the antique store. Design an algorithm where the user will enter the price of each of the four items. The algorithm will determine the subtotal, the sales tax, and the total purchase amount. Assume the sales tax is 7%.
Be sure to think about the logic and design first (input-process-output (IPO) chart, flowchart, and pseudocode). Display all output using currency formatting.
Advanced (optional): Use a constant for the 7% sales tax.
Rubric
Point distribution for this activity:
iLab Activity
Document
Points possible
Points received
Variable list
10
IPO chart
10
Flowchart
10
Pseudocode/C# code
10
Desk-check
10
Total Points
50
Name:_________________
(1) Variable List With Data Type
List all the variables you will use (use valid variable names). Indicate whether the data type is string, integer, or double, and so on.
(2) IPO Model
List the inputs, any processes, calculations, and outputs. Use the same valid variable names you used in Step 1.
Inputs
Process (calculations)
Outputs
(3) Flowchart
Use MS Visio to create a flowchart. Paste the flowchart here, or attach as separate document. Use the same valid variable names you used in Step 1.
(4) Pseudocode or C# Code
Describe your solution using pseudocode or actual C# code. Use the same valid variable names you selected in Step 1.
(5) Desk-Check
Desk-check your solution by selecting appropriate test data.
Test data: List the values for your test data.
Expected output: What is the expected output of your program?
Step
Variables (write variable names in first line below)
Output
Enter step numbers
1
2
3
Week 2 Activity—Game Seating Charges
TCO 2—Given a simple problem, design a solution algorithm that uses arithmetic expressions and built-in functions.
Assignment
Your goal is to solve the following simple programming exercise. You have been contracted by a local stadium to design an algorithm determining the total seating charges for any game held at the stadium. Lower-level seats cost $25 per seat, mid-level seats cost $15 per seat, and upper-level seats cost $10 per seat. The algorithm should ask the user for the number of seats being purchased in each seating level. Then, the algorithm will determine the total for each level and a grand total for the enti.
Alcohol Awareness Special Lecture ReflectionAlcohol is among the.docxsimonlbentley59018
Alcohol Awareness Special Lecture Reflection
Alcohol is among the most commonly used and abused substances in today's society, and is of particular interest in the college aged population as there are many habits and tendencies of college students in regards to alcohol use that do not extend past those 4 years (i.e. pre-gaming, drinking games, drinking to get "blacked out", etc.).
Miami University Peer Hawks is an amazing group of YOUR PEERS who are dedicated to increasing awareness about safe alcohol use, as well as many other health behaviors (see the Peer Hawks Website (Links to an external site.)Links to an external site. for more information, and check out their video below). Specifically, they have created an Alcohol Skills Training Program that is specialized for YOU.
For this assignment, I'd like you to review the Alcohol Skills Training Program (ASTP) PowerPoint, and write a 2 page reflection. In this reflection, you may discuss anything that you'd like in regards to the ASTP lecture. In addition, I'd like you to consider the following questions:
1. What information, if any, was new to you? If so, were you surprised by any of the information presented? Explain.
2. How have you seen the impact of alcohol use in your life? Either personally, or generally (i.e. on campus, in your hometown, etc.)?
3. What is your major take away point from this special lecture? Why?
**NOTES**
· Your paper must be in 12 point Times New Roman font, double spaced, with 1 inch margins on all sides.
· At the top of page 1, please use only your name in the header at the top of the page (i.e. do not put the date, my name, the class name, the assignment name, etc.)
· This ASTP PowerPoint can also be found in the Modules Tab.
Framework/.DS_Store
__MACOSX/Framework/._.DS_Store
Framework/Main.javaFramework/Main.javapackage test;
import calculation.*;
publicclassMain{
publicstaticvoid main(String[] args)
{
MyStack[] stacks =newMyStack[5];
for(int i =0; i <5; i++){
stacks[i]=newMyStack();
}
//testing stacks[2]
System.out.println("***************** Case 1 **********************");
stacks[2].addItem("1");
System.out.println("stacks[2] has "+ stacks[2].getSize()+" item(s)");
stacks[2].showItems();
//testing s2
System.out.println("***************** Case 2 **********************");
MyStack s2 =newMyStack("5 + 2 + 32 * 10");
System.out.println("s2 has "+ s2.getSize()+" item(s)");
s2.showItems();
ProcessStack.parseMyStack(s2);
//testing s3
System.out.println("****************** Case 3 *********************");
MyStack s3 =newMyStack("5+2+32*10");
System.out.println("s3 has "+ s3.getSize()+" item(s)");
s3.showItems();
//testing s4
System.out.println("******************* Case 4 ********************");
MyStack s4 =newMyStack("d5 ~c+ 2$+a32*10b");
System.out.println("s4 has "+ s4.getSize()+" item(s)");
s4.showItems();
ProcessStack.parseMyStack(s4);
//testing s5
System.out.println("******************* .
Week 2 iLab TCO 2 — Given a simple problem, design a solutio.docxmelbruce90096
Week 2 iLab
TCO 2 — Given a simple problem, design a solution algorithm that uses arithmetic expressions and built-in functions.
Scenario
Your goal is to solve the following simple programming exercise. You have been contracted by a local antique store to design an algorithm determining the total purchases and sales tax. According to the store owner, the user will need to see the subtotal, the sales tax amount, and the total purchase amount. A customer is purchasing four items from the antique store. Design an algorithm where the user will enter the price of each of the four items. The algorithm will determine the subtotal, the sales tax, and the total purchase amount. Assume the sales tax is 7%.
Be sure to think about the logic and design first (input-process-output (IPO) chart, flowchart, and pseudocode). Display all output using currency formatting.
Advanced (optional): Use a constant for the 7% sales tax.
Rubric
Point distribution for this activity:
iLab Activity
Document
Points possible
Points received
Variable list
10
IPO chart
10
Flowchart
10
Pseudocode/C# code
10
Desk-check
10
Total Points
50
Name:_________________
(1) Variable List With Data Type
List all the variables you will use (use valid variable names). Indicate whether the data type is string, integer, or double, and so on.
(2) IPO Model
List the inputs, any processes, calculations, and outputs. Use the same valid variable names you used in Step 1.
Inputs
Process (calculations)
Outputs
(3) Flowchart
Use MS Visio to create a flowchart. Paste the flowchart here, or attach as separate document. Use the same valid variable names you used in Step 1.
(4) Pseudocode or C# Code
Describe your solution using pseudocode or actual C# code. Use the same valid variable names you selected in Step 1.
(5) Desk-Check
Desk-check your solution by selecting appropriate test data.
Test data: List the values for your test data.
Expected output: What is the expected output of your program?
Step
Variables (write variable names in first line below)
Output
Enter step numbers
1
2
3
Week 2 Activity—Game Seating Charges
TCO 2—Given a simple problem, design a solution algorithm that uses arithmetic expressions and built-in functions.
Assignment
Your goal is to solve the following simple programming exercise. You have been contracted by a local stadium to design an algorithm determining the total seating charges for any game held at the stadium. Lower-level seats cost $25 per seat, mid-level seats cost $15 per seat, and upper-level seats cost $10 per seat. The algorithm should ask the user for the number of seats being purchased in each seating level. Then, the algorithm will determine the total for each level and a grand total for the enti.
Alcohol Awareness Special Lecture ReflectionAlcohol is among the.docxsimonlbentley59018
Alcohol Awareness Special Lecture Reflection
Alcohol is among the most commonly used and abused substances in today's society, and is of particular interest in the college aged population as there are many habits and tendencies of college students in regards to alcohol use that do not extend past those 4 years (i.e. pre-gaming, drinking games, drinking to get "blacked out", etc.).
Miami University Peer Hawks is an amazing group of YOUR PEERS who are dedicated to increasing awareness about safe alcohol use, as well as many other health behaviors (see the Peer Hawks Website (Links to an external site.)Links to an external site. for more information, and check out their video below). Specifically, they have created an Alcohol Skills Training Program that is specialized for YOU.
For this assignment, I'd like you to review the Alcohol Skills Training Program (ASTP) PowerPoint, and write a 2 page reflection. In this reflection, you may discuss anything that you'd like in regards to the ASTP lecture. In addition, I'd like you to consider the following questions:
1. What information, if any, was new to you? If so, were you surprised by any of the information presented? Explain.
2. How have you seen the impact of alcohol use in your life? Either personally, or generally (i.e. on campus, in your hometown, etc.)?
3. What is your major take away point from this special lecture? Why?
**NOTES**
· Your paper must be in 12 point Times New Roman font, double spaced, with 1 inch margins on all sides.
· At the top of page 1, please use only your name in the header at the top of the page (i.e. do not put the date, my name, the class name, the assignment name, etc.)
· This ASTP PowerPoint can also be found in the Modules Tab.
Framework/.DS_Store
__MACOSX/Framework/._.DS_Store
Framework/Main.javaFramework/Main.javapackage test;
import calculation.*;
publicclassMain{
publicstaticvoid main(String[] args)
{
MyStack[] stacks =newMyStack[5];
for(int i =0; i <5; i++){
stacks[i]=newMyStack();
}
//testing stacks[2]
System.out.println("***************** Case 1 **********************");
stacks[2].addItem("1");
System.out.println("stacks[2] has "+ stacks[2].getSize()+" item(s)");
stacks[2].showItems();
//testing s2
System.out.println("***************** Case 2 **********************");
MyStack s2 =newMyStack("5 + 2 + 32 * 10");
System.out.println("s2 has "+ s2.getSize()+" item(s)");
s2.showItems();
ProcessStack.parseMyStack(s2);
//testing s3
System.out.println("****************** Case 3 *********************");
MyStack s3 =newMyStack("5+2+32*10");
System.out.println("s3 has "+ s3.getSize()+" item(s)");
s3.showItems();
//testing s4
System.out.println("******************* Case 4 ********************");
MyStack s4 =newMyStack("d5 ~c+ 2$+a32*10b");
System.out.println("s4 has "+ s4.getSize()+" item(s)");
s4.showItems();
ProcessStack.parseMyStack(s4);
//testing s5
System.out.println("******************* .
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
Write a program that mimics the operations of several vending machines. More specifically, the
program simulates what happens when the user chooses one of the vending machines, inputs
money and picks an item from the vending machine. Assume there are two vending machines:
one for drinks and one for snacks. Each vending machine contains several items. The name,
price, and quantity of each item is given in two text files; one named “drinks.txt” for the drinks
vending machine and the other named “snacks.txt” for the snacks vending machine.
The format of the input values is comma-separated. The items listed should be organized in the
file with the following order: name, price, quantity. Here are some example items:
The actual reading and parsing of the input file is already handled in the class supplied to you
(see code on BlackBoard). You are given the variables as individual values. You will need to
create the .txt files for creating and testing your vending machines.
You will need to create/complete three classes for this homework assignment: Item,
VendingMachine, and VendingMachineDriver.
Problem Description
Milk,2.00,1
Within your VendingMachine class, include these methods:
VendingMachineThisconstructormethodwilltakeinthenameoftheinputfileand create a vending
machine object. A vending machine object will contain an array of Item objects called stock and
an amount of revenue earned. This constructor method has been completed for you and should
work appropriately once you have completed the rest of this class and the other class definitions.
vendThismethodwillsimulatethevendingtransactionafteravalidamountofmoney and an item
selection are entered. This method will decide if the transaction is successful (enough money or
item) and update the vending machine appropriately.
outputMessage This method will print an appropriate message depending on the success of the
transaction. If the user does not have enough money to buy the chosen item, the vending machine
should prompt the user to enter more money or exit the machine. If the vending machine is out of
the chosen item, the program will print an apology message and prompt the user to choose
another item or exit the machine. If there is enough money for the item selected, then the
vending machine will give the user the item and return the change.
printMenuThismethodprintsthemenuofitemsforthechosenvendingmachine. The Item class needs
to include the following data variables:
• description as a String
• price as a double
• quantity as an int
Within your VendingMachineDriver class, include a main method as the starting point for your
solution that creates the vending machine objects appropriately and then use a loop that
continues interacting with the vending machines until the user enters “X” to exit. See the sample
session for details.
As you implement your solution, you might find that some methods contain some repeated
coding logic. To avoid unnecessary redundancies in your code, have these method.
Esta charla comprende las lecciones aprendidas convirtiendo la app de Android de Teambox (una app repleta de deuda técnica y con un alto nivel de acoplamiento entre clases), en la versión actual de Redbooth, que intenta cumplir la arquitectura Hexagonal y los principios SOLID. Durante la exposición explicaremos como fuimos desenredando el código paso a paso; como aplicamos por partes los conceptos de la arquitectura hexagonal; como dejamos de lado componentes del framework de Android que dificultaban el mantenimiento de la app; y que errores cometimos, como los solucionamos y como se podrían haber evitado.
ITECH 2100 Programming 2 School of Science, Information Te.docxchristiandean12115
ITECH 2100
Programming 2
School of Science, Information Technology and
Engineering
CRICOS Provider No. 00103D Page 1 of 13
Major Assignment
Semester 1, 2018
Learning Objectives:
The learning objectives for this major assignment are:
K1. Explain the principles of inheritance, composition and their consequences
K2. Discuss basic object-oriented concepts
K3. Explain the principles of event-driven programming
S1. develop object-oriented programs involving several interacting classes
S2. incorporate pre-written classes, including those from the SDK, into software solutions
S3. develop object-oriented programs which involve both object-oriented and event-driven aspects
A1. design, develop, test and debug programs from supplied program specifications
Purpose
By completing this assignment, you will develop your understanding of and apply object-oriented
programming techniques, in particular, those relating to inheritance and polymorphism. You will develop
skills and experience in the use of the Java Collections API classes and I/O classes. You will demonstrate
your ability to successfully design and develop a working event-driven system.
You will develop a multi-class program to meet functional specifications applying design principles and
making use of the ArrayList and Map abstract data types.
You are encouraged to partner with another student and engage in paired programming to complete this
assignment.
This major assignment will be submitted in 3 stages. Each stage will build on the previous stage. You will also
be asked to demonstrate or describe your code to highlight particular concepts you have implemented. This
demonstration/reflection will be individually assessed.
ITECH 2100
Programming 2
School of Science, Information Technology and
Engineering
CRICOS Provider No. 00103D Page 2 of 13
Assignment Overview:
This assignment requires you to complete various tasks involving classes you write with your partner. You
may also use classes that you find in the Java SDK.
The system that you will create is a Farmer’s Market Management System (FMMS). The FMMS is a tool
used by Dogwood Council to manage multiple Farmer’s Markets in their area. A Farmer’s Market may be
located at different sites, for different purposes (e.g. open-air market or indoor market, charity market,
community fundraising market, food swap market etc.) and different opening times.
Each Market has a name and is associated with a particular address and session time. Each Market is also
made up of stalls selling items. This IT system, FMMS, will enable the Council-manager to manage
information about the farmers market as well as the stalls.
It will be possible to inspect details for each stall separately. The details will include specifics of the stall as
well as specific details regarding discounts that may apply to certain items (e.g. All green apples might be
half price). Stalls will be.
show code and all classes with full implementation for these Program S.pdfAlanSmDDyerl
show code and all classes with full implementation for these Program Specifications.
Example products ( camcorder, dvd player, blueray player, tv, camera, xbox 360, ps4, Wii,
laptops, iphone, battery, smart phones, computer desktop, printer, usb, mouse)
Develop an inventory management system for an electronics store. The inventory system should
have the following functionalities:
BuildInventory: read a text file containing electronics products information and dynamically
store them in an array of pointers.
ShowInventory: display all inventory items.
UpdateInventory: ask for item id and quantity. If found display cost and update Product object
info (reduce Product's quantity and potentially update restocking flag).
Terminate: save current inventory to a text file.
This programming assignment illustrates the following concepts:
Text file reading and writing.
Arrays of pointers and dynamic memory allocations with new and delete.
Inheritance.
C++ type casting: static_cast.
NOTE: This assignment is not about polymorphism or dynamic_cast! Your program should not
contain any virtual function and/or use of dynamic_cast mechanism or point deductions will
apply. You will have opportunity to use polymorphism in the next assignment.
Class Design
You need at least three classes.
class InventoryItem (minimum implementation specified below) - This is the base class.
Protected member data: item id (integer) and restocking (bool).
Public static data:
const integer (item id): initialize to 9999.
const bool (restocking): initialize to false.
Constructors
Default constructor: initialize item id and restocking using the default static data with member
initializer syntax.
Non-default constructor: take 2 parameters.
Destructor: output "InventoryItem <item id> with <true/false> restocking destroyed ..."
Public member functions:
mutator/accessor for restocking, item id.
Display : to show InventoryItem item id and restocking (true/false). item id must be displayed as
a 4-digit integer with leading 0s if < 1000.
class Product : derived from InventoryItem class (minimum implementation specified below).
Private member data: name (string), quantity (integer) and price (double).
Public static data:
const string (name): "No Product".
const int (quantity): 0
const double (price): 0.99
Constructors (use member initializer syntax)
Default constructor: set member data to static data's default values above. Must explicitly invoke
the base class' default constructor.
Non-default constructor: take five parameters (id, restocking, name, quantity and price). Must
explicitly invoke the base class' non-default constructor.
Destructor: output "Product: <item id>, Name<name>, quantity<quantity>, price <price>,
restocking<true/false> destroyed ...".
Public member functions:
accessors/mutators for name, quantity, price.
Display: invoke Display from base class, then display its own data. NOTE: If the product
restocking is true somehow indicate it using "special effects" such as ***** or wh.
Morgage/build/classes/.netbeans_automatic_build
Morgage/build/classes/.netbeans_update_resources
Morgage/build/classes/morgage/Morgage.classpackage morgage;
publicsynchronizedclass Morgage {
public void Morgage();
public void programFunction();
public double calculateMonthlyPropertyTax(double);
public double calculateMonthlyInsurancePremium(double);
public double calculateMonthlyPrincipleInterestLoan(double, double);
public void display(double, double, double);
publicstatic void main(String[]);
}
Morgage/build.xml
Builds, tests, and runs the project Morgage.
Morgage/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Morgage/nbproject/build-impl.xml
...
TYPO3 Extension development using new Extbase frameworkChristian Trabold
My presentation for the TYPO3 community day in Tokyo, Japan.
The code is available at https://github.com/ctrabold/t3ski-workshop.
Due to copyright issues I had to remove all pictures of Miffy.
How does an open source operating system like Linux® affect Internet.pdfjyothimuppasani1
How does an open source operating system like Linux® affect Internet security and safety?
Solution
Since open source operating system\'s code is available to all,it\'s provides an easy access to
hackers and potential misusers which affects safety of such systems.
The non stable nature of Open source operating system also can be considered an important
factor that affects the Security.This is because Developers all over the globe modify the code and
thus the code is not stable and it becomes vulnerable to security threats.
Even if patches are introduced from time to time,mostly after an attack or so but due to large
flavours or distributions of open source software, some flavours are left without patches that
makes them vulnerable to attacks.
Also,The administration of open source operating system Servers also plays an important factor
in Internet Security. Since it is known that for example,Linux Server administration is more
difficult and when multiple ports are open it is sometimes not possible to handle an attack or
security threat immediately.
But then as it is said that every coin has two sides, Sometimes it is considered that Open Source
Systems like Linux are more secure because of the following reasons :.
Help please!!(Include your modified DList.java source code file in.pdfjyothimuppasani1
Help please!!
(Include your modified DList.java source code file in your homework solution zip archive)
Using
whatever Java IDE you prefer, create a project and add DList.java and DListTest.java to it (these
files are provided
in the Week 6 Source zip archive). Modify DList to implement a method that removes all
occurrences of a specific
integer from the list. Here is the pseudocode:
Method removeAll(In: Integer pData) Returns Nothing
Define index variable i and initialize i to 0
While i < the size of this Dlist Do
If get(i) equals pData Then
remove(i)
Else
Increment i
End If
End While
End Method removeAll
Next, modify DListTest() to add test case 21 which tests that removeAll() works correctly.
WHat more do i need to provide to get help on this???
Solution
/* DListNode.java */
/**
* A DListNode is a node in a DList (doubly-linked list).
*/
class DListNode {
/**
* item references the item stored in the current node.
* prev references the previous node in the DList.
* next references the next node in the DList.
*
* DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
*/
public Object item;
protected DListNode prev;
protected DListNode next;
/**
* DListNode() constructor.
* @param i the item to store in the node.
* @param p the node previous to this node.
* @param n the node following this node.
*/
DListNode(Object i, DListNode p, DListNode n) {
item = i;
prev = p;
next = n;
}
}
/* DList.java */
/**
* A DList is a mutable doubly-linked list ADT. Its implementation is
* circularly-linked and employs a sentinel (dummy) node at the head
* of the list.
*
* DO NOT CHANGE ANY METHOD PROTOTYPES IN THIS FILE.
*/
class DList {
/**
* head references the sentinel node.
* size is the number of items in the list. (The sentinel node does not
* store an item.)
*
* DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
*/
protected DListNode head;
protected int size;
/* DList invariants:
* 1) head != null.
* 2) For any DListNode x in a DList, x.next != null.
* 3) For any DListNode x in a DList, x.prev != null.
* 4) For any DListNode x in a DList, if x.next == y, then y.prev == x.
* 5) For any DListNode x in a DList, if x.prev == y, then y.next == x.
* 6) size is the number of DListNodes, NOT COUNTING the sentinel,
* that can be accessed from the sentinel (head) by a sequence of
* \"next\" references.
*/
/**
* newNode() calls the DListNode constructor. Use this class to allocate
* new DListNodes rather than calling the DListNode constructor directly.
* That way, only this method needs to be overridden if a subclass of DList
* wants to use a different kind of node.
* @param item the item to store in the node.
* @param prev the node previous to this node.
* @param next the node following this node.
*/
protected DListNode newNode(Object item, DListNode prev, DListNode next) {
return new DListNode(item, prev, next);
}
/**
* DList() constructor for an empty DList.
*/
public DList() {
// Your solution here.
head = newNode(null, head, head);
head.prev = head;
head.next = head;
si.
More Related Content
Similar to You are to write a GUI program that will allow a user to buy, sell a.pdf
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
Write a program that mimics the operations of several vending machines. More specifically, the
program simulates what happens when the user chooses one of the vending machines, inputs
money and picks an item from the vending machine. Assume there are two vending machines:
one for drinks and one for snacks. Each vending machine contains several items. The name,
price, and quantity of each item is given in two text files; one named “drinks.txt” for the drinks
vending machine and the other named “snacks.txt” for the snacks vending machine.
The format of the input values is comma-separated. The items listed should be organized in the
file with the following order: name, price, quantity. Here are some example items:
The actual reading and parsing of the input file is already handled in the class supplied to you
(see code on BlackBoard). You are given the variables as individual values. You will need to
create the .txt files for creating and testing your vending machines.
You will need to create/complete three classes for this homework assignment: Item,
VendingMachine, and VendingMachineDriver.
Problem Description
Milk,2.00,1
Within your VendingMachine class, include these methods:
VendingMachineThisconstructormethodwilltakeinthenameoftheinputfileand create a vending
machine object. A vending machine object will contain an array of Item objects called stock and
an amount of revenue earned. This constructor method has been completed for you and should
work appropriately once you have completed the rest of this class and the other class definitions.
vendThismethodwillsimulatethevendingtransactionafteravalidamountofmoney and an item
selection are entered. This method will decide if the transaction is successful (enough money or
item) and update the vending machine appropriately.
outputMessage This method will print an appropriate message depending on the success of the
transaction. If the user does not have enough money to buy the chosen item, the vending machine
should prompt the user to enter more money or exit the machine. If the vending machine is out of
the chosen item, the program will print an apology message and prompt the user to choose
another item or exit the machine. If there is enough money for the item selected, then the
vending machine will give the user the item and return the change.
printMenuThismethodprintsthemenuofitemsforthechosenvendingmachine. The Item class needs
to include the following data variables:
• description as a String
• price as a double
• quantity as an int
Within your VendingMachineDriver class, include a main method as the starting point for your
solution that creates the vending machine objects appropriately and then use a loop that
continues interacting with the vending machines until the user enters “X” to exit. See the sample
session for details.
As you implement your solution, you might find that some methods contain some repeated
coding logic. To avoid unnecessary redundancies in your code, have these method.
Esta charla comprende las lecciones aprendidas convirtiendo la app de Android de Teambox (una app repleta de deuda técnica y con un alto nivel de acoplamiento entre clases), en la versión actual de Redbooth, que intenta cumplir la arquitectura Hexagonal y los principios SOLID. Durante la exposición explicaremos como fuimos desenredando el código paso a paso; como aplicamos por partes los conceptos de la arquitectura hexagonal; como dejamos de lado componentes del framework de Android que dificultaban el mantenimiento de la app; y que errores cometimos, como los solucionamos y como se podrían haber evitado.
ITECH 2100 Programming 2 School of Science, Information Te.docxchristiandean12115
ITECH 2100
Programming 2
School of Science, Information Technology and
Engineering
CRICOS Provider No. 00103D Page 1 of 13
Major Assignment
Semester 1, 2018
Learning Objectives:
The learning objectives for this major assignment are:
K1. Explain the principles of inheritance, composition and their consequences
K2. Discuss basic object-oriented concepts
K3. Explain the principles of event-driven programming
S1. develop object-oriented programs involving several interacting classes
S2. incorporate pre-written classes, including those from the SDK, into software solutions
S3. develop object-oriented programs which involve both object-oriented and event-driven aspects
A1. design, develop, test and debug programs from supplied program specifications
Purpose
By completing this assignment, you will develop your understanding of and apply object-oriented
programming techniques, in particular, those relating to inheritance and polymorphism. You will develop
skills and experience in the use of the Java Collections API classes and I/O classes. You will demonstrate
your ability to successfully design and develop a working event-driven system.
You will develop a multi-class program to meet functional specifications applying design principles and
making use of the ArrayList and Map abstract data types.
You are encouraged to partner with another student and engage in paired programming to complete this
assignment.
This major assignment will be submitted in 3 stages. Each stage will build on the previous stage. You will also
be asked to demonstrate or describe your code to highlight particular concepts you have implemented. This
demonstration/reflection will be individually assessed.
ITECH 2100
Programming 2
School of Science, Information Technology and
Engineering
CRICOS Provider No. 00103D Page 2 of 13
Assignment Overview:
This assignment requires you to complete various tasks involving classes you write with your partner. You
may also use classes that you find in the Java SDK.
The system that you will create is a Farmer’s Market Management System (FMMS). The FMMS is a tool
used by Dogwood Council to manage multiple Farmer’s Markets in their area. A Farmer’s Market may be
located at different sites, for different purposes (e.g. open-air market or indoor market, charity market,
community fundraising market, food swap market etc.) and different opening times.
Each Market has a name and is associated with a particular address and session time. Each Market is also
made up of stalls selling items. This IT system, FMMS, will enable the Council-manager to manage
information about the farmers market as well as the stalls.
It will be possible to inspect details for each stall separately. The details will include specifics of the stall as
well as specific details regarding discounts that may apply to certain items (e.g. All green apples might be
half price). Stalls will be.
show code and all classes with full implementation for these Program S.pdfAlanSmDDyerl
show code and all classes with full implementation for these Program Specifications.
Example products ( camcorder, dvd player, blueray player, tv, camera, xbox 360, ps4, Wii,
laptops, iphone, battery, smart phones, computer desktop, printer, usb, mouse)
Develop an inventory management system for an electronics store. The inventory system should
have the following functionalities:
BuildInventory: read a text file containing electronics products information and dynamically
store them in an array of pointers.
ShowInventory: display all inventory items.
UpdateInventory: ask for item id and quantity. If found display cost and update Product object
info (reduce Product's quantity and potentially update restocking flag).
Terminate: save current inventory to a text file.
This programming assignment illustrates the following concepts:
Text file reading and writing.
Arrays of pointers and dynamic memory allocations with new and delete.
Inheritance.
C++ type casting: static_cast.
NOTE: This assignment is not about polymorphism or dynamic_cast! Your program should not
contain any virtual function and/or use of dynamic_cast mechanism or point deductions will
apply. You will have opportunity to use polymorphism in the next assignment.
Class Design
You need at least three classes.
class InventoryItem (minimum implementation specified below) - This is the base class.
Protected member data: item id (integer) and restocking (bool).
Public static data:
const integer (item id): initialize to 9999.
const bool (restocking): initialize to false.
Constructors
Default constructor: initialize item id and restocking using the default static data with member
initializer syntax.
Non-default constructor: take 2 parameters.
Destructor: output "InventoryItem <item id> with <true/false> restocking destroyed ..."
Public member functions:
mutator/accessor for restocking, item id.
Display : to show InventoryItem item id and restocking (true/false). item id must be displayed as
a 4-digit integer with leading 0s if < 1000.
class Product : derived from InventoryItem class (minimum implementation specified below).
Private member data: name (string), quantity (integer) and price (double).
Public static data:
const string (name): "No Product".
const int (quantity): 0
const double (price): 0.99
Constructors (use member initializer syntax)
Default constructor: set member data to static data's default values above. Must explicitly invoke
the base class' default constructor.
Non-default constructor: take five parameters (id, restocking, name, quantity and price). Must
explicitly invoke the base class' non-default constructor.
Destructor: output "Product: <item id>, Name<name>, quantity<quantity>, price <price>,
restocking<true/false> destroyed ...".
Public member functions:
accessors/mutators for name, quantity, price.
Display: invoke Display from base class, then display its own data. NOTE: If the product
restocking is true somehow indicate it using "special effects" such as ***** or wh.
Morgage/build/classes/.netbeans_automatic_build
Morgage/build/classes/.netbeans_update_resources
Morgage/build/classes/morgage/Morgage.classpackage morgage;
publicsynchronizedclass Morgage {
public void Morgage();
public void programFunction();
public double calculateMonthlyPropertyTax(double);
public double calculateMonthlyInsurancePremium(double);
public double calculateMonthlyPrincipleInterestLoan(double, double);
public void display(double, double, double);
publicstatic void main(String[]);
}
Morgage/build.xml
Builds, tests, and runs the project Morgage.
Morgage/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Morgage/nbproject/build-impl.xml
...
TYPO3 Extension development using new Extbase frameworkChristian Trabold
My presentation for the TYPO3 community day in Tokyo, Japan.
The code is available at https://github.com/ctrabold/t3ski-workshop.
Due to copyright issues I had to remove all pictures of Miffy.
How does an open source operating system like Linux® affect Internet.pdfjyothimuppasani1
How does an open source operating system like Linux® affect Internet security and safety?
Solution
Since open source operating system\'s code is available to all,it\'s provides an easy access to
hackers and potential misusers which affects safety of such systems.
The non stable nature of Open source operating system also can be considered an important
factor that affects the Security.This is because Developers all over the globe modify the code and
thus the code is not stable and it becomes vulnerable to security threats.
Even if patches are introduced from time to time,mostly after an attack or so but due to large
flavours or distributions of open source software, some flavours are left without patches that
makes them vulnerable to attacks.
Also,The administration of open source operating system Servers also plays an important factor
in Internet Security. Since it is known that for example,Linux Server administration is more
difficult and when multiple ports are open it is sometimes not possible to handle an attack or
security threat immediately.
But then as it is said that every coin has two sides, Sometimes it is considered that Open Source
Systems like Linux are more secure because of the following reasons :.
Help please!!(Include your modified DList.java source code file in.pdfjyothimuppasani1
Help please!!
(Include your modified DList.java source code file in your homework solution zip archive)
Using
whatever Java IDE you prefer, create a project and add DList.java and DListTest.java to it (these
files are provided
in the Week 6 Source zip archive). Modify DList to implement a method that removes all
occurrences of a specific
integer from the list. Here is the pseudocode:
Method removeAll(In: Integer pData) Returns Nothing
Define index variable i and initialize i to 0
While i < the size of this Dlist Do
If get(i) equals pData Then
remove(i)
Else
Increment i
End If
End While
End Method removeAll
Next, modify DListTest() to add test case 21 which tests that removeAll() works correctly.
WHat more do i need to provide to get help on this???
Solution
/* DListNode.java */
/**
* A DListNode is a node in a DList (doubly-linked list).
*/
class DListNode {
/**
* item references the item stored in the current node.
* prev references the previous node in the DList.
* next references the next node in the DList.
*
* DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
*/
public Object item;
protected DListNode prev;
protected DListNode next;
/**
* DListNode() constructor.
* @param i the item to store in the node.
* @param p the node previous to this node.
* @param n the node following this node.
*/
DListNode(Object i, DListNode p, DListNode n) {
item = i;
prev = p;
next = n;
}
}
/* DList.java */
/**
* A DList is a mutable doubly-linked list ADT. Its implementation is
* circularly-linked and employs a sentinel (dummy) node at the head
* of the list.
*
* DO NOT CHANGE ANY METHOD PROTOTYPES IN THIS FILE.
*/
class DList {
/**
* head references the sentinel node.
* size is the number of items in the list. (The sentinel node does not
* store an item.)
*
* DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
*/
protected DListNode head;
protected int size;
/* DList invariants:
* 1) head != null.
* 2) For any DListNode x in a DList, x.next != null.
* 3) For any DListNode x in a DList, x.prev != null.
* 4) For any DListNode x in a DList, if x.next == y, then y.prev == x.
* 5) For any DListNode x in a DList, if x.prev == y, then y.next == x.
* 6) size is the number of DListNodes, NOT COUNTING the sentinel,
* that can be accessed from the sentinel (head) by a sequence of
* \"next\" references.
*/
/**
* newNode() calls the DListNode constructor. Use this class to allocate
* new DListNodes rather than calling the DListNode constructor directly.
* That way, only this method needs to be overridden if a subclass of DList
* wants to use a different kind of node.
* @param item the item to store in the node.
* @param prev the node previous to this node.
* @param next the node following this node.
*/
protected DListNode newNode(Object item, DListNode prev, DListNode next) {
return new DListNode(item, prev, next);
}
/**
* DList() constructor for an empty DList.
*/
public DList() {
// Your solution here.
head = newNode(null, head, head);
head.prev = head;
head.next = head;
si.
how can I replace the Newsfeed text with a custom on in SharePoi.pdfjyothimuppasani1
how can I replace the \"Newsfeed\" text with a custom on in SharePoint 365.
(Newsfeed Webpart)
Solution
First of all there are some differences between sharepoint and office 365. SharePoint has 4
versions still in active use : SharePoint 2007,2010,2016 and office 365. Office 365 released in
2011 With SharePoint2010 interface. Office 365 hav a various exclusive features like NextGen
Portals (Out of the box “ready to go” portals), Delve (A technology based on Office Graph that
presents “relevant information” to you based on your actions and interactions with colleague
files), Sway (A presentation web par that allows users to combine text, images and videos locally
and from the wider internet to create a usable website.), Yammer Integration (Yammer is the
enterprise social network that\'s being gradually rolled into all Office 365 features.) anf Office
365 Groups.
A custom CSS included in SharePoint master page in order to customize Newsfeed Web Part.
the code is:
.ms-microfeed-siteFeedTitleArea
{
background-color: silver;
padding-left: 20px;
text-transform:uppercase;
padding-bottom: 3px;
padding-top: 2px;
margin-bottom: 5px;
}
.ms-microfeed-siteFeedMicroBlogPart
{
margin-bottom: 2px;
}
.ms-microfeed-siteFeedTitleLabel
{
color: red !important;
}
.ms-microfeed-threadsDiv
{
height: 250px;
overflow-y: auto;
overflow-x: hidden;
}
.ms-microfeed-thread
{
max-width: 435px;
margin-bottom: 10px;
}
.ms-microfeed-replyArea
{
max-width: 375px;
min-width: 300px;
}
.ms-microfeed-attachmentButton
{
padding-top: 2px;
padding-bottom: 2px;
display: block;
}
.ms-microfeed-postButton
{
padding-top: 2px;
padding-bottom: 2px;
}
.ms-microfeed-postButtonSpan
{
margin-top: 2px;
}
.ms-microfeed-postBox
{
height: 20px;
}
Apart from this we can also hide controls, for this first we need to activate Site Feed feature, to
do this go to site settings->Manage Site Features and activate it
script for hide controls
I used the following CSS classes and its worked.
.ms-microfeed-cancelButton{
background-color: #fcfcfc !important;
border: 1px solid #d4d4d4 !important;
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
border-radius: 10px !important;
color: #00a6d9 !important;
height: 22px !important;
padding-top: 3px !important;
width: 78px !important;
font-family: Arial !important;
font-size: 11px!important;
font-weight: normal !important;
}
.ms-microfeed-siteFeedTitleArea
{
background-color: silver;
padding-left: 20px;
text-transform:uppercase;
padding-bottom: 3px;
padding-top: 2px;
margin-bottom: 5px;
}
.ms-microfeed-siteFeedMicroBlogPart
{
margin-bottom: 2px;
}
.ms-microfeed-siteFeedTitleLabel
{
color: red !important;
}
.ms-microfeed-threadsDiv
{
height: 250px;
overflow-y: auto;
overflow-x: hidden;
}
.ms-microfeed-thread
{
max-width: 435px;
margin-bottom: 10px;
}
.ms-microfeed-replyArea
{
max-width: 375px;
min-width: 300px;
}
.ms-microfeed-attachmentButton
{
padding-top: 2px;
padding-bottom: 2px;
padding-bottom: 2px;
display: block;
}
.ms-microfeed-pos.
Hello!This is Java assignment applet.Can someone help me writing.pdfjyothimuppasani1
Hello!
This is Java assignment applet.
Can someone help me writing a code how to exit the game when I press no in question( would
you like to play again?). Also if no one wins or draws i would like to pop up the question ( would
you like to play again?). I have the code below i would like someone to add it
Thanks in advance!
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TicTacToe extends Applet implements ActionListener{
// Array to store buttons
JButton button[][] = new JButton[3][3];
boolean isNewGame =false;
// To switch player either X or O
boolean isZero = true; //first turn is always 0
// Setup size
// Set layout to grid
// Create buttons through loop
// Add buttons to layout
// Add listener
public void init(){
setSize(500, 500);
setLayout(new GridLayout(3,3));
// if it is not a new game
if(isNewGame==false) {
// Adding buttons to layout
//initialize the Grid and add ActionListener to each Button
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
// init jButton
button[i][j] = new JButton(\"\");
// Setup Font and Size here
button[i][j].setFont(new Font(\"Lucida Grande\", Font.PLAIN, 28));
// Add is a method from applet to add buttons in layout
add(button[i][j]);
// Listener
button[i][j].addActionListener(this);
}
}
}
else {
// If we need to restart the game, then we only set text to empty
// Back to black color
// add listener
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
button[i][j].setText(\"\");
button[i][j].setForeground(Color.BLACK);
button[i][j].removeActionListener(this);
button[i][j].addActionListener(this);
}
}
}
}
// Go all the buttons in arrsy
// Check the event with button in array
// if player O is true, set button text O. Otherwise. X
// Remove Listerner. Why? only once you can click
// Change player by isZero
// Check for winner
public void actionPerformed(ActionEvent event){
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++){
if((event.getSource() == button[i][j])){
if(isZero){
button[i][j].setText(\"O\");
}
else{
button[i][j].setText(\"X\");
}
button[i][j].removeActionListener(this); //you cannot click on one tile more than
once
isZero = !isZero;
checkForWinners(); //check if any winner after each move
}
}
}
public void checkForWinners(){
//3 horizontal lines
for(int i = 0; i < 3; i++){
if(button[i][0].getText().equals(button[i][1].getText())
&& button[i][1].getText().equals(button[i][2].getText())
&& !button[i][0].getText().equals(\"\")){
String player = button[i][0].getText();
button[i][0].setForeground(Color.RED);
button[i][1].setForeground(Color.RED);
button[i][2].setForeground(Color.RED);
int reply =JOptionPane.showConfirmDialog(null, player + \" wins!\"+\"\ Would like
to play again?\",\"Game over\",JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
isNewGame = true;
init();
return;
}
else {
System.exit(0);
return;
}
}
}
//3 vertical lines
for(int i = 0; i < 3; i++){
if(button[0][i].getText().equals(button[1][i].getText())
&& .
For each of the following reseach questions identify the observation.pdfjyothimuppasani1
For each of the following reseach questions identify the observational units and variable (s)
P. 1.2Subjects listened to ten second of the Jackson 5 \'s song \"ABC\" and then were how long
they thought the song snippet lasted . Do people tend to overestimate the song length?
Solution
variable is song length. In other words the time subjects think they listened to song.
unit is seconds.
Find an Eulerian trail in the following graph. Be sure to indicate th.pdfjyothimuppasani1
Find an Eulerian trail in the following graph. Be sure to indicate the order in which the edges are
visited.
Solution
Eulerian path/ trail:
A path is called as Eulerian path if every edge of the graph G appears exactly ince in the path.
NOTE::
A graph possesses an Eulerian trail if and only if it is connected and has either zero and 2
vertices of odd degrees
ANSWER:
order -> h,d,c,b,f,e,b,a,e,i,j,f,g,k,l,h,g,c,d.
File encryption. [32] Write a program which accepts a filename as a .pdfjyothimuppasani1
File encryption. [32] Write a program which accepts a filename as a command-line argument [-
32]. It should then ask for a password via stdin (but it should not visible when entered; use
getpass for this) [4]. The program should encrypt the file using a block-cipher algorithm (see
encryption.rst for details) [12] if it was not already encrypted by the program, and rename it with
a .enc extension. If it was already encrypted, it should decrypt the file and remove the .enc
extension [12]. Under no circumstance should the program multiply encrypt the file [4]. Call the
program encrypt.cpp. here is encrypt.rst Suppose I have an input file to encrypt: .. raw: The only
true wisdom is in knowing you know nothing. (A quote by Socrates.) What I can do then is ask
the user for a password. Suppose the user enters kitties. Then what I may do is pre-pend the
password to an output file, and add kitties in rounds to the file: .. raw: kittiesThe only true
wisdom is in knowing you know nothing. + kittieskittieskittieskittieskittieskittieskittieskittieskit -
---------------------------------------------------------- =
fhdkalhfioepwahfkdsanklvcxznkjvpwipqnkxlkdlajsflkjkljkljlkd When I add the characters in the
string kitties, I get what appears to be jumbled garbage. Without the password, it is hard to
decrypt the file. To decrypt the file, I ask the user for the password. Suppose they enter bubbles
(the wrong password). .. raw: fhdkalhfioepwah... - bubbles ------------------ = ueiaqnv I see that
by subtracting bubbles off the encrypted text, I do not get the string bubbles back, so bubbles is
not the password. If the user enters kitties (the correct password): .. raw: fhdkalhfioepwah... -
kitties ------------------ = kitties Then I see that what I get back is kitties, and since it matches the
user password entered, I may proceed to decrypt the rest of the file simply by subtracting kitties
off it in rounds. .. raw: = fhdkalhfioepwahfkdsanklvcxznkjvpwipqnkxlkdlajsflkjkljkljlkd -
kittieskittieskittieskittieskittieskittieskittieskittieskit ------------------------------------------------------
----- kittiesThe only true wisdom is in knowing you know nothing. Thus I obtain the original
message. Notice the user-supplied password itself is a necessary element of the decryption. This
type of algorithm is called a block cipher algorithm.
Solution
// Encrypting_a_File.cpp : Defines the entry point for the console
// application.
//
#include
#include
#include
#include
#include
// Link with the Advapi32.lib file.
#pragma comment (lib, \"advapi32\")
#define KEYLENGTH 0x00800000
#define ENCRYPT_ALGORITHM CALG_RC4
#define ENCRYPT_BLOCK_SIZE 8
bool MyEncryptFile(
LPTSTR szSource,
LPTSTR szDestination,
LPTSTR szPassword);
void MyHandleError(
LPTSTR psz,
int nErrorNumber);
int _tmain(int argc, _TCHAR* argv[])
{
if(argc < 3)
{
_tprintf(TEXT(\"Usage: \")
TEXT(\" | \ \"));
_tprintf(TEXT(\" is optional.\ \"));
_tprintf(TEXT(\"Press any key to exit.\"));
_gettch();
return 1;
}
LPTS.
Explain the relevance that medical standards of practice have to one.pdfjyothimuppasani1
Explain the relevance that medical standards of practice have to one as a practioner?
Solution
\'Providing care\' incorporates, however isn\'t restricted to any care,
treatment, counsel, administration or merchandise gave in regard
of the physical or emotional well-being of a man, regardless of whether
compensated or genius bono.
\'Practice\' implies any part, regardless of whether compensated or not,
in which the individual uses their aptitudes and learning
as a specialist in their controlled wellbeing calling. For
the motivations behind this Code, rehearse isn\'t limited to
the arrangement of direct clinical care. It additionally incorporates utilizing
proficient learning in a direct nonclinical relationship
with patients or customers, working in administration,
organization, instruction, look into, warning, administrative or
arrangement improvement parts and whatever other parts that effect
on sheltered, powerful conveyance of wellbeing administrations in the wellbeing
calling.
Keeping up and creating learning, aptitudes and
proficient conduct are center parts of good practice.
This requires self-reflection and support in pertinent
proficient advancement, rehearse change and
execution evaluation procedures to persistently create
proficient capacities. These exercises must proceed
through a specialist\'s working life as science and
innovation create and society changes.
giving specialists who are patients or customers with
a similar nature of care gave to different patients or
customers
b). informing the sheets if treating another enrolled
specialist who has set patients or customers in danger
of significant mischief while rehearsing their calling
since they have an impedance (allude to the
board\'s rules on compulsory detailing) this is a
proficient and also a statutory obligation under
the National Law
At the point when specialists are engaged with look into that includes
patients or customers, great practice incorporates:
a). regarding the privilege of patients or customers to pull back
from an investigation without partiality to their treatment
b). guaranteeing that a choice by patients or customers not to
take an interest does not bargain the specialist
tolerant/customer relationship or the care of the patient or
customer..
Find the mission and values statements for four different hospita.pdfjyothimuppasani1
Find the mission and values statements for four different hospital types. Do their missions and
values reconcile with your expectations for the type of organization? Look at a religious based
organization. Does their mission and values reflect their religious teachings and mission? Now
examine a for-profit hospital. Does their mission and values include the need to increase their
owners\' value and maximizing their earning? Why do you think the missions and values are
structured as they are? 1. The missions and values are structured as they are to meet the desires
of the stakeholders. The specifics of this question must be left to the particulars of the
instructional environment.
Solution
We will describe mission and value statements of four hospitals given below:-
a) Seattle Children\'s Hospital
Mission statement:-
We provide hope, care and cures to help every child live the healthiest and most fulfilling life
possible.
Value statement:-
Compassion
Empathy for patients, their families and staff is ingrained in our history and inspires our future.
We do more than treat the child; we practice family-centered care as the cornerstone of
compassion.
Excellence
Our promise to treat, prevent and cure pediatric disease is an enormous responsibility. We follow
the highest standards of quality and safety and expect accountability from each other.
Integrity
At all times, we approach our work with openness, transparency, decency and humility. It is our
responsibility to use resources wisely to sustain Seattle Children’s for generations to come.
Collaboration
We work in partnership with patients, their families, staff, providers, volunteers and donors. This
spirit of respectful cooperation extends beyond our walls to our business partners and the
community.
Equity
We embrace and find strength in the diversity of our patients, their families, staff and
community. We believe all children deserve exceptional care, the best outcomes, respect and a
safe environment.
Innovation
We aspire to be an innovative leader in pediatric healthcare, research and philanthropy. We
continually seek new and better solutions. Because innovation springs from knowledge, we
foster learning in all disciplines.
b) Rochester Regional Health
Mission statement:-
To enhance lives and preserve health by enabling access to a comprehensive, fully integrated
network of the highest quality and most affordable care, delivered with kindness, integrity and
respect.
Value Statement:-
Quality
By setting and surpassing higher standards, we will continue to build a smarter, faster, more
efficient organization that delivers excellent, appropriate care in the right place at the right time.
Compassion
Our culture of caring will be unmistakable in every personal interaction as we treat individuals,
families and colleagues with empathy, honesty and openness.
Respect
We will treat each individual with caring consideration and value the diverse perspectives each
one of them can bring.
Collaboration
By w.
Did colonial rule freeze colonized societies by preserving old s.pdfjyothimuppasani1
Did colonial rule \"freeze\" colonized societies by preserving old social and economic patterns,
or was colonial rule a disruptive force of change?
Provide specific evidence to support each side of this question.
Solution
Transforming: Colonial rule gave African women greater autonomy in their day to day lives,
some of whom took advantage of trade.
New opportunities were also offered to cash crop farmers who were able to use colonial trade
networks for their own benefit.
Large scale conversion of some populations to Christianity
A minority got Western educations, which transformed their lives and their vision of their
society.
Preserving: No colonial society underwent Japanese-style industrialization.
Colonial societies engages mostly in primary economic activities, such as agriculture.
Colonialism stunted the growth of the middle class, creating unstable societies.
The practice of ruling through established authorities maintained the status quo..
Do you think that nonhuman animals have interests Does this mean th.pdfjyothimuppasani1
Do you think that nonhuman animals have interests? Does this mean that they also have rights?
Explain.
Solution
Human beings are living beings and so are the animals. A man is a known as a social animal only
because he has the ability to speak and interact in a more civilized way than any other animals.
But having said that, the rights surrounding to the human beings such as the ‘Right to live’,
remains the same even for the feral human beings who are such humans who are raised in the
Jungle and are isolated for some reason from the human world or contact. In this regard, if one
cannot distinguish a feral child, who can simply screech or crawl, rather than walk on two legs
and behave more like animals than like humans, from that of any other civilized human being,
then such a distinguished nature of human beings towards the nonhuman animals, is simply a
biased opinion. Animals are mute. They cannot speak for themselves. But they too have a heart
that throb like a human. They feel hunger. They feel the pain too. Even they long
companionship. They long for a community of their own to co-stay. Hence, I do believe
nonhuman animals do have interests. In such a case, they also have rights. They are simply
helpless because they are unable to reach us out in our ways. But that is not their fault. Perhaps
the rule of nature. The nature requires all to co-exist and hence the Noah’s ark once gave shelter
to creatures of all kind and not just restricted to the mankind. Even the nature wants the creatures
to live in harmony and that is possible when we do not invade their territory but of course, let not
them invade ours too. However, in today’s world, man’s greed has unturned the entire balanced
eco-cycle. We have deeply penetrated into the woods and concretized the Jungle to the extent
that we have quite literally done away with the interests of these nonhuman animals. For the
balanced eco-system, the contribution of the nonhuman animals have also been very significant.
But in a course of time, we snatched away their rights. Yes, we have laws in place to protect the
near-to-extinct animals or to stop killing or preying the nonhuman animals for organs selling and
other purposes. However, the illegal exploitation of these nonhuman animals have only helped us
think that perhaps the interests of the nonhumans or their rights are of much lesser importance
than that of the pleasure of the human beings for the only reason being that we, the humans can
speak and represent for ourselves. In the mask of civilization, we are rather heading to a more
sophisticated way of demeaning the rights of the animals or their interests..
Discuss the importance of recognizing and implementing different ent.pdfjyothimuppasani1
Discuss the importance of recognizing and implementing different entry strategies and
organizational arrangements which result in shared control and oversight through collaborative
relationships
Solution
Entry strategies are explained as a well planned method through which the company decide to
delivery its good and services to the targeted market.
The different types of market entry strategies and organizational arrangement and its importance
are discussed below:
1 .Exporting: when goods/Product are produced in one country and marketed in another country
then it is known as exporting.
2. Licensing: When a firm permit the company operating in another company to use its
manufacturing process, copyrights, and trademark with specific and determined payment.
3. Franchising: It’s an agreement between two companies, where a company (the franchiser)
gives all its rights to another company (the franchisee) to use its trademark, manufacturing
process and market to certain specification.
4. Joint venturing: In this two companies or investors share ownership and control over the
finance and operations of the firm.
5. Contract Manufacturing: In this the company operating in foreign countries gets into contract
to with the country operating there for manufacturing or assembling of the product.
6. Merger & Acquisitions: It is defined as restructuring of organization, for positive growth and
value. Merger means to ‘merge’ in which two companies legally merge into one into one entity,
whereas an acquisition means when one company takes over another and completely become
new owner.
All the entry strategies discussed above results in shared control through collaborative
relationships..
Considering the challenges she is facing, what Anitas plan before .pdfjyothimuppasani1
Considering the challenges she is facing, what Anita\'s plan before the strategic planning retreat?
How would you reformulate the art center mission, has the center need a new strategy? why or
why not?
Solution
Anitha wants to bring some new innovation arts to the Arts center. This also brings more profit
for her. People who are crazy of arts expect more attractive and interesting arts,so she has to
increase her quality of arts to entertain the art lovers. Few people who don\'t have any knowledge
about arts also started trying out with arts. The art center mission can be reformulated by
inspiring them in participating in performances and they have to feel that what time they have
towards arts must be meaningful.
The strategy that can be used by sponsoring and contributing. This work can get help by adding
partners also. Through this they can teach others and also bring their talents out. By performing
like this the whole community gets attracted and her dream comes true. Through this they can
bring out the most hidden artists in the community and many artists are come out showing their
excellence in their art..
Data Structure in C++Doubly Linked Lists of ints httpstaffwww.pdfjyothimuppasani1
Data Structure in C++
Doubly Linked Lists of ints
http://staffwww.fullcoll.edu/aclifton/courses/cs133_fa16/files/dlist.h
This is my code below: dlist.cc
-------------------------------------------------------------------------------------------------------
#include
#include \"dlist.h\"
dlist::node* dlist::at(int n){
node* c = _head;
while(n > 0 && c){
c = c->next;
n--;
}
return c;
}
void dlist::insert(node* previous, int value){
node* n = new node{value, previous->next};
previous->next = n;
}//update tail
void dlist::del(node* which){
node* nn = which->next;
which->next = nn->next;
delete nn;
}
void dlist::push_back(int value){
node* n = new node{value, nullptr};
_tail->next = n;
_tail-> n;
}
void dlist::push_front(int value){
node* n = new node(value, nullptr);
_head->prev = n;
_head-> n;
}
void dlist::pop_front(){
node* n = _head;
_head = _head->next;
delete n;
}
void dlist::pop_back(){
node* n = _tail;
_tail = _tail->prev;
delete n;
}
int dlist::size() {
node* c = _head;
int s = 0;
while(c){
s++;
c = c->next;
}
return s;
}
--------------------------------------------------------------------------------
Please fix and complete my code, and I also need whole code contatining main function for
testing dlist.cc In this assignment, you will implement a doubly-linked list class. together with
some list operations. To make things easier, you\'ll implement a list of int rather than a template
class pragma once dlist. h Doubly linked lists of ints include Kostream class dlist public: d list
struct node int value node next node prev; node\' head() const return -head; node\" tail() const t
return -tail Implement ALL the following methods Returns the node at a particular index (0 is the
head node at(int) Insert a new value, after an existing one void insert(node *previous int value
Delete the given node void del (node which)
Solution
#include
#include
#include
/*
* Node Declaration
*/
using namespace std;
struct node
{
int value;
string name;
struct node *next;
struct node *prev;
}*start;
/*class declaration
class dlist
{
public:
void create_list(int value);
void push_front(int value);
void push_back(int value, int position);
void pop_front(int value);
void pop_back(int value);
void display_dlist();
void reverse();
dlist()
{
start = NULL;
head=NULL;
last=NULL;
}
bool empty() const { return head==NULL; }
friend ostream& operator<<(ostream& ,const dlist& );
void insert(const string& );
void remove(const string& );
private:
node* head() const { return _head; }
node* tail() const { return _tail; }
};
dlist.cc:
/* Create Double Link List*/
void dlist::create_list(int value)
{
struct node *s, *temp;
temp = new(struct node);
temp->info = value;
temp->next = NULL;
if (start == NULL)
{
temp->prev = NULL;
start = temp;
}
else
{
s = start;
while (s->next != NULL)
s = s->next;
s->next = temp;
temp->prev = s;
}
}
/*
* Insertion at the beginning
*/
void dlist::add_begin(int value)
{
if (start == NULL)
{
cout<<\"First Create the list.\"<prev = NULL;
temp->info = val.
Conceptual skills are most important at theSolutionConceptual .pdfjyothimuppasani1
Conceptual skills are most important at the
Solution
Conceptual skills relate to the managers\' mental ability to coordinate and integrate all of the
organization\'s interests and activities. It is about thinking in the abstract and observing
relationships between forces that many others may not be able to see and to take a global
perspective of the organization and its environment. This is not so relevant at the lower level of
management and is most important at the top management level because the senior managers
must look for and exploit unseen opportunities for their organizations..
A variable whose scope is restricted to the method where it was decl.pdfjyothimuppasani1
A variable whose scope is restricted to the method where it was declared is known as a(n)
parameter
global variable
local variable
public instance data
private instance data
parameter
global variable
local variable
public instance data
private instance data
Solution
Answer is \"Local Variable\"
Parameter: parameter is something which is passed to the method, and not declared in the
method.
Global Variable: Global Variable is accessible from anywhere in the program. And not just
restricted to a certain method..
•Design (create) 3 questions for a quiz show game and design regular.pdfjyothimuppasani1
•Design (create) 3 questions for a quiz show game and design regular expressions that validate
the answers. The challenge is to be no more and no less exacting than a human checker. I have
the sample quiz done already.email me for code
Solution
Database design
• Not easy!
• Will discuss formal methods next week
• Review: databases are made up of
– Tables: tables made up of
• Records: records made up of fields
• Speaking of rows and columns is misleading
• Critical issue: fixed number of fields, though a
specific field may be optional (aka not required)
– NOT NULL in MySQL jargon means required!
– MySQL does support variable length strings.
Data types
• Terminology varies for different DBMS
products
• Performance (speed) of operations varies
with different datatypes
• Size varies with different datatypes
• Performance and size limits are points of
competition among the different products
MySQL datatypes: numbers
• INT (aka INTEGER), can be UNSIGNED
(Size 4 bytes = 32 bits)
• TINYINT, SMALLINT, MEDIUMINT,
BIGINT
– Different sizes
• float (4 bytes), double (8 bytes), can
specify precision within these limits
• more
MySQL datatypes, strings
• CHAR(specified length)
• VARCHAR(maximum length)
• TINYBLOB short, variable length string,
up to 255 characters
• BLOB, TEXT variable length string
• MEDIUMBLOB, MEDIUMTEXT,
LONGBLOB, LONGTEXT
MySQL datatypes: enum
• ENUM
– Specify one of a set of values
– Stored as an integer, with 0 indicated unset or
not in the specified set
– Doing this may be more efficient because
built-in MySQL routines do the searching
MySQL datatypes: date/time
• DATE
• TIME
• DATETIME
• YEAR
• TIMESTAMP
Tables
• Specify one field as the primary key
• Primary keys are unique IN THAT TABLE
– Let the DBMS create the primary key OR
– Depend on intrinsic value that is guaranteed to be
unique
• Email addresses
• ISBN numbers
• ?
• A field in one table may be a foreign key. This is
a reference to a primary key in another table (or
this table). MORE ON THIS LATER.
Database
• Assume database itself is created for us
AND we have permissions to create new
tables.
• NOTE: permissions can be set by MySQL
commands, including queries sent by php.
• Start off talking general SQL and then
specific php and MySQL
Create table example
• CREATE TABLE movies (
mid INT NOT NULL AUTO_INCREMENT
PRIMARY KEY,
mname CHAR(30),
mdesc TEXT,
myear YEAR
)
Create table example
CREATE TABLE players (
pid INT NOT NULL AUTO_INCREMENT
PRIMARY KEY,
pname CHAR(30),
score INT NOT NULL,
lastplayed DATE
)
Create example
CREATE TABLE games (
gid INT NOT NULL AUTO_INCREMENT
PRIMARY KEY,
pid INT,
gtime TIMESTAMP,
score INT
)
The pid field will refer to / have the value of
the pid field (the primary key) of a specific
player. Here in this table, it is called a
foreign key.
Foreign keys
• Some versions of MySQL (and other DBMS)
have ways to specify the the pid value is a
foreign key
pid INT REFERENCE players
• The DBMS will check to make sure it is a valid
value.
• Since the php.
write the To Dos to get the exact outputNOte A valid Fraction .pdfjyothimuppasani1
write the To Do\'s to get the exact output:
NOte: A valid Fraction number has a non-negative numerator and a positive denominator.
Default constructor initializes the object to safe empty state (an object with denom equals -1).
The two-argument constructor also validates the parameters and sets the object to the safe empty
state if the parameters are not valid.
Write the definitions and prototypes of following functions in Fraction.cpp and Fraction.h
respectively (They are indicated in the files by //TODO tag):
Define isEmpty function as a member function, which returns true if the object is in safe empty
state (an object is in the safe empty state if denominator (denom) equals -1).
Define display function, which sends a Fraction number to the output stream (with the
“Numerator/denominator” format). This function just prints \"Invalid Fraction Object!\" in the
screen if the object is in the safe empty state. In case that object denominator equals 1, it just
print the numerator.
Define the operator functions for the following operators:
“+=”, “+”, “*”
The overload of the above operators should make the following code possible:
The member operator+ : Adds two Fraction numbers and returns a Fraction number as the result.
This function returns an object with the safe empty state if either of Fraction numbers (operands)
is in safe empty state. It makes following code possible:
A+B ( where A and B are Fraction objects)
The member operator+= : Adds two Fraction numbers and assigns the result to the left operand,
then returns a reference to the left operand. If either of Fraction numbers (operands) is in safe
empty state, it initializes the left operand to the safe empty state, then returns a reference to the
left operand. It makes following code possible:
A+=B ( where A and B are Fraction objects)
The member operator* : Multiplies two Fraction numbers and returns a Fraction number as the
result. This function returns an object with the safe empty state if either of Fraction numbers
(operands) is in safe empty state. It makes following code possible:
A*B ( where A and B are Fraction objects)
fraction.cpp
#include \"Fraction.h\"
using namespace std;
namespace sict{
Fraction::Fraction(){
denom =-1; // safe empty state
}
Fraction::Fraction(int n, int d) // n: numerator, d: denominator
{
if(n >= 0 && d > 0){
num = n;
denom = d;
reduce();
}
else
denom =-1; // set to safe empty state
}
int Fraction::gcd() // returns the greatest common divisor of num and
denom
{
int mn = min(); // min of num and denom
int mx = max(); // mX of num and denom
for (int x=mn ; x > 0 ; x--) // find the greatest common divisor
if( mx % x == 0 && mn % x == 0)
return x;
return 1;
}
void Fraction::reduce() // simplify the Fraction number
{
int tmp = gcd();
num /= tmp;
denom /= tmp;
}
int Fraction::max ()
{
return (num >= denom) ? num : denom;
}
int Fraction::min()
{
return (num >= denom) ? denom : num;
}
// in_lab
// TODO: write the implementation of display function HERE
// TODO: w.
What are the factors that contribute to H+ gain or loss How do lung.pdfjyothimuppasani1
What are the factors that contribute to H+ gain or loss? How do lungs and the kidneys balance or
regulate the changes in pH?
Solution
Answer=
Factors that contribute to loss or gain of H ions are=
CO2 concentration
O2 concentration
bicarbonate concentration in urine
The lungs regulate the changes in PH = Acid base imbalances in the bloods pH can be altered by
changes in breathing to expel ,ore CO2 & raise the pH back to normal
Hydrogen ions are carried in the blood along with oxygen & carbon dioxide
60 % CO2 is carried as a dissolved bicarbonate
A small amount of CO2 is carried on Haemoglobin as carbaminohaemoglobin which is
transported to the lungs for removal
Acid base imbalances that overcome the buffer system can be compensated in the short term by
changing the rate of ventilation
When pH of blood drops too low ,the body compensates by increasing breathing to expel more
CO2 & during alkalemia the inspiration occurs
Regulation of pH by kidneys =
kidneys have 2 important roles in maintaining the acid -base balance
1]They reabsorb bicarbonate from urine
2] they excrete hydrogen ions into urine
The major homeostatic control point for maintaining a stable pH balance is renal excretion
Bicarbonate does not have transporter ,so its reabsorption involves a series of reactions in the
tubule lumen & tubular epithelium .
In response tyo acidosis the tubular cells reabsorb more bicarbonate from the tubular fluid ,& the
collecting cells secrete more hydrogen & generate more bicarbonate
In response to alkalosis ,the kidneys may excrete more bicarbonate by decreasing Hydrogen ion
secretion from tubular epithelial cells ,& lowering the rates of glutamine metabolism &
ammonium excretion.
Write down the four (4) nonlinear regression models covered in class,.pdfjyothimuppasani1
Write down the four (4) nonlinear regression models covered in class, i.e. both the name of the
model and their functional form showing their respective regression coefficients. A rapidly
growing bacteria has been discovered with a growth rate as shown in the table. Analyze this date
using a power law model. First linearize the data in the table based on the power law model, call
this new linearized data x and y. Next, determine the coefficients a_0 and a_1 of a linear
regression y = a_0 + a_1x for the linearized power law data x and y, and compute the correlation
coefficient for the liner regression. Note that you are not being asked to do a linear regression of
the data in the table but rather a linear regression of the linearized version of that data. Once you
compute a_0 and a_1 use these to determine the coefficients of the power law model. Write a
Matlab script that uses the polyfit function to determine the regression coefficients of a second
order polynomial fit to data in the table. In the same script, write down the code for using the
polyval command to determine the value of the regression curve at the observed times.
Solution
Nonlinear regression is a statistical technique that helps describe nonlinear relationships in
experimental data. A nonlinear regression model can be written Yn = f(xn, ) + Zn where f is the
expectation function and xn is a vector of associated regressor variables or independent variables
for the nth case.
A nonlinear model is one in which at least one of the parameters appears nonlinearly. More
formally, in a nonlinear model, at least one derivative with respect to a parameter should involve
that parameter. Examples of a nonlinear model are:
Y(t) = exp(at+bt2)
Y(t) = at + exp(-bt).
Important non linear growth models
1.Logistic Model
This model is represented by the differential equation
dN/dt = rN (1-N/K).
Integrating, we get
N(t) = K / [1+(K/No-1) exp(-rt)]
The graph of N(t) versus t is elongated S-shaped and the curve is symmetrical about its point of
inflexion.
2.Malthus Model
If N(t) denotes the population size or biomass at time t and r is the intrinsic growth rate, then the
rate of growth of population size is given by
dN/dt = rN.
Integrating, we get
N(t) = No exp (rt),
where No denotes the population size at t=0. Thus this law entails an exponential increase for
r>0. Furthermore, N(t) à as t à , which cannot happen in reality.
3. Monomolecular Model
This model describes the progress of a growth situation in which it is believed that the rate of
growth at any time is proportional to the resources yet to be achieved, i.e.
dN/dt = r(K-N),
where K is the carrying size of the system. Integrating (3.3), we get
N(t) = K-(K-No) exp (-rt).
4. Richards Model.
This model is given by dN/dt = rN (KN – Nm)/mKm which, on integration, gives N(t )=K N0 /[
N0+ (KN – N0m) exp (-rt)]1/m.
Unlike the earlier models, this model has four parameters
Hours (H)
10
20
40
50
No fo bacteria (N)
25
70
380
550
610
b)
N = b H m
Log10.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
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.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
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.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
You are to write a GUI program that will allow a user to buy, sell a.pdf
1. You are to write a GUI program that will allow a user to buy, sell and view stocks in a stock
portfolio.
Objective:
Write a GUI program that maintains a cash balance, list of stock holdings, supports buying and
selling of stocks and displays the current portfolio inventory.
Program Capabilities:
1. Allow a user to buy a stock with a given number of shares and price per share.
2. Display the current portfolio (stock ticker, number of shares, initial price).
3. Update the portfolio display for purchases and sales.
4. Allow the user to sell all of the shares of a given stock.
5. Give the user an initial cash balance, and update and display the balance according to the
user's purchases and sales.
6. Ignore any transaction that causes the cash position to go below $0.
USE OF PREVIOUS StockHolding and PortfolioList LABS IS ADVISED. (I've including my
solutions to these below)
This is my written code from earlier homework:
public class StockHolding {
private String ticker;
private int numShares;
private double initialSharePrice;
private double currentSharePrice;
public StockHolding(String ticker, int numberShares, double initialPrice) {
this.ticker = ticker;
numShares = numberShares;
initialSharePrice = initialPrice;
currentSharePrice = initialPrice;
}
public double getCurrentValue() {
return numShares * getCurrentSharePrice();
}
public double getInitialCost() {
2. return numShares * getInitialSharePrice();
}
public double getCurrentProfit() {
return getCurrentValue() - getInitialCost();
}
public double getCurrentSharePrice() {
return currentSharePrice;
}
public void setCurrentSharePrice(double currentSharePrice) {
this.currentSharePrice = currentSharePrice;
}
public String getTicker() {
return ticker;
}
public int getShares() {
return numShares;
}
public double getInitialSharePrice() {
return initialSharePrice;
}
@Override
public String toString() {
return "Stock " + ticker + ", " + numShares + ", shares bought at "
+ initialSharePrice + ", current price "
+ currentSharePrice;
}
}
AND
import java.util.ArrayList;
public class PortfolioList {
private ArrayList portfolio;
public PortfolioList() {
portfolio = new ArrayList();
3. }
public void add(StockHolding stock) {
portfolio.add(stock);
}
public StockHolding find(String ticker) {
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
return sh;
}
}
return null;
}
public void remove(String ticker) {
int pos = -1;
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
pos = i;
}
}
if (pos != -1) {
portfolio.remove(pos);
}
}
I've been staring at this for two days, and I am lost. Please, any guidance/help would be greatly
appreciated.
Honestly don't even need a full solution, just need something to kick start. A comment skeleton
would help a ton. Thanks!
Solution
SOURCE CODE:
4. package stock;
public class StockHolding {
private String ticker;
private int numShares;
private double initialSharePrice;
private double currentSharePrice;
public StockHolding(String ticker, int numberShares, double initialPrice) {
this.ticker = ticker;
numShares = numberShares;
initialSharePrice = initialPrice;
currentSharePrice = initialPrice;
}
public double getCurrentValue() {
return numShares * getCurrentSharePrice();
}
public double getInitialCost() {
return numShares * getInitialSharePrice();
}
public double getCurrentProfit() {
return getCurrentValue() - getInitialCost();
}
public double getCurrentSharePrice() {
return currentSharePrice;
}
public void setCurrentSharePrice(double currentSharePrice) {
this.currentSharePrice = currentSharePrice;
}
public String getTicker() {
return ticker;
}
5. public int getShares() {
return numShares;
}
public double getInitialSharePrice() {
return initialSharePrice;
}
public void setNumShares(int numShares) {
this.numShares = numShares;
}
@Override
public String toString() {
return "Stock " + ticker + ", " + numShares + ", shares bought at "
+ initialSharePrice + ", current price "
+ currentSharePrice;
}
}
--------------------------------------------------------------------------------------------------------------------
---
package stock;
import java.util.ArrayList;
/**
*
* @author Gojkid
*/
public class PortfolioList {
private ArrayList portfolio;
public PortfolioList() {
portfolio = new ArrayList();
}
public void add(StockHolding stock) {
portfolio.add(stock);
}
6. public StockHolding find(String ticker) {
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
return sh;
}
}
return null;
}
public int getPos(StockHolding sh)
{
return portfolio.indexOf(sh);
}
public int getSize()
{
return portfolio.size();
}
public StockHolding getElement(int i) {
return portfolio.get(i);
}
public void remove(String ticker) {
int pos = -1;
for (int i = 0; i < portfolio.size(); i++) {
StockHolding sh = portfolio.get(i);
if (sh.getTicker().equals(ticker)) {
pos = i;
}
}
if (pos != -1) {
portfolio.remove(pos);
}
}
}
--------------------------------------------------------------------------------------------------------------------
---
7. /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* StockTrading.java
*
* Created on Nov 29, 2016, 12:43:57 AM
*/
package stock;
import javax.swing.table.DefaultTableModel;
public class StockTrading extends javax.swing.JFrame {
/** Creates new form StockTrading */
public StockTrading() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {
ticker = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
portfolio = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
price = new javax.swing.JTextField();
number = new javax.swing.JSpinner();
buy = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
balance = new javax.swing.JTextField();
sell = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
message = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Stock Trading Program");
ticker.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A – Agilent
Technologies", "AAPL – Apple Inc.", "BRK.A – Berkshire Hathaway", "C – Citigroup",
"GOOG – Alphabet Inc.", "HOG – Harley-Davidson Inc.", "HPQ – Hewlett-Packard",