Solution :
public class [tex]$\text{Stock}$[/tex] {
private [tex]$\text{String}$[/tex] stockName, [tex]$\text{purchaseDate}$[/tex];
private [tex]$\text{int}$[/tex] nShares;
private [tex]$\text{double}$[/tex] price;
public [tex]$\text{Stock}()$[/tex]
{
this.stockName = "";
this.purchaseDate = "";
this.nShares = 0;
this.price = 0.0;
}
public Stock(String stockName, String purchaseDate, int nShares, double price) {
this.stockName = stockName;
this.purchaseDate = purchaseDate;
this.nShares = nShares;
this.price = price;
}
public String getStockName() {
return stockName;
}
public void setStockName(String stockName) {
this.stockName = stockName;
}
public String getPurchaseDate() {
return purchaseDate;
}
public void setPurchaseDate(String purchaseDate) {
this.purchaseDate = purchaseDate;
}
public int getnShares() {
return nShares;
}
public void setnShares(int nShares) {
this.nShares = nShares;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String toString()
{
return("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate
+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price));
}
public void printStock()
{
System.out.println("Stock name: " + this.stockName + "\nPurchase date: " + this.purchaseDate
+ "\nNumber of shares of stock: " + this.nShares + "\nPrice: $" + String.format("%,.2f", this.price)
+ "\n");
}
}
StockTester.java (Driver class)
import [tex]$\text{java.io.}$[/tex]File;
import [tex]$\text{java.io.}$[/tex]File[tex]$\text{NotFound}$[/tex]Exception;
import [tex]$\text{java.util.}$[/tex]ArrayList;
import [tex]$\text{java.util.}$[/tex]Scanner;
[tex]$\text{public}$[/tex] class StockTester {
private static final String FILENAME = "StockInfo[tex]$.$[/tex]csv";
public static [tex]$\text{void}$[/tex] main([tex]$\text{String}[]$[/tex] args)
{
ArrayList[tex]$<\text{stock}>$[/tex] dataStock = [tex]$\text{readData}$[/tex](FILENAME);
System.out.println("Initial stocks:");
for(Stock s : dataStock)
s.printStock();
System.out.println("Adding a new Stock object to the list..");
Stock newStock = new Stock("Gamma", "03/01/20", 100, 50.5);
dataStock.add(newStock);
System.out.println("\nStocks after adding the new Stock..");
for(Stock s : dataStock)
s.printStock();
Stock targetStock = dataStock.get(3);
double reqReturn = requiredReturn(targetStock, 4000, 3);
System.out.println("Required rate of return = " + String.format("%.2f", reqReturn) + "%");
}
private static ArrayList<Stock> readData(String filename)
{
ArrayList<Stock> stocks = new ArrayList<>();
Scanner fileReader;
try
{
fileReader = new Scanner(new File(filename));
while(fileReader.hasNextLine())
{
String[] data = fileReader.nextLine().trim().split(",");
String stockName = data[0];
String purchaseDate = data[1];
int nShares = Integer.parseInt(data[2]);
double price = Double.parseDouble(data[3]);
stocks.add(new [tex]$\text{Stock}$[/tex](stockName, [tex]$\text{purcahseDate}$[/tex], nShares, price));
}
fileReader.close();
}catch(FileNotFoundException fnfe){
System.out.println(filename + " cannot be found!");
System.exit(0);
}
return stocks;
}
private static double requiredReturn(Stock s, double targetPrice, int years)
{
double reqReturn;
double initialPrice = s.getPrice() * s.getnShares();
reqReturn = ((targetPrice - initialPrice) / initialPrice * years) * 100;
return reqReturn;
}
}
Using a tag, set the color to green for all tags.
Answer:
<style>
p {
background-color: rgb(255, 0, 0);
}
h1 {
background-color: rgb(0, 255, 0);
}
ol {
background-color: rgb(97,51,47);
}
</style>
Explanation:
Put this at the top of your code. It should target the paragraph tag, the header h1 tag, and the Ordered List (OL) tag individually and set their background colors respectively.
It's been a while since I've done CSS so you might have to tweak the syntax a bit, but it should look something like that.
How SPARQL 1.1 has advantage over SPARQL 1.0??
Please Fix This For Me
print ("Please enter a number between 1 and 100")
n = input
if = n < 1 and n > 100:
if = (n // 2 == 0):
print (n, "is even")
if = (n // 3 == 0):
print (n, "is odd")
else:
print("You have not entered a number between 1 and 100.")
Answer:
The correction is as follows:
n = int(input("Please [tex]enter\ a[/tex] [tex]number\ between\ 1[/tex] and 100: "))
if n < 1 or n > 100:
print("You [tex]have\ not[/tex] entered a [tex]number\ between\ 1[/tex] and 100.")
elif n % 2 == 0:
print (n, "is even")
else:
print (n, "is odd")
Explanation:
See attachment for explanation
63. Name the 4 main lights & and their primary purpose.
Which of the following is not part of the four ways you can avoid problems with email communication?
a.
Be brief.
b.
Proofread your message.
C.
Reply right away after you get an email.
d.
Seek other ways to relay your message
Answer:
d is the correct answer for this problem
When identifying who will send a presentation, what are the two types of audiences?
Answer:
Explanation:Demographic audience analysis focuses on group memberships of audience members. Another element of audience is psychographic information, which focuses on audience attitudes, beliefs, and values. Situational analysis of the occasion, physical setting, and other factors are also critical to effective audience analysis.
Consider the following method:
public static String joinTogether(int num, String[] arr)
{
String result = "";
for (String x : arr)
{
result = result + x.substring(0, num);
}
return result;
}
The following code appears in another method in the same class:
String[] words = {"dragon", "chicken", "gorilla"};
int number = 4;
System.out.println(joinTogether(number, words));
What is printed when the code above is executed?
a. dragonchickengorilla
b. drachigor
c. dragchicgori
d. dragochickgoril
e. There is an error in the program, it does not run
Answer: b.
Explanation:
how many stages needed to have powerful amplifier?
Power amplifier stages in a real circuit. Circuit diagram of a three stage practical audio power amplifier is shown in the figure below. Small signal transistor Q1 and its associated components form the voltage amplification stage.
Answer:
Generally you should pick an amplifier that can deliver power equal to twice the speaker's program/continuous power rating. This means that a speaker with a “nominal impedance” of 8 ohms and a program rating of 350 watts will require an amplifier that can produce 700 watts into an 8 ohm load.