The class diagram and pseudocode for the StockTransaction class is given below
What is the class?plaintext
Class: StockTransaction
-----------------------
- symbol: string
- name: string
- shares: int
- pricePerShare: float
+ setSymbol(symbol: string)
+ getSymbol(): string
+ setName(name: string)
+ getName(): string
+ setShares(shares: int)
+ getShares(): int
+ setPricePerShare(price: float)
+ getPricePerShare(): float
Pseudocode for the StockTransaction class:
plaintext
Class StockTransaction
Private symbol as String
Private name as String
Private shares as Integer
Private pricePerShare as Float
Method setSymbol(symbol: String)
Set this.symbol to symbol
Method getSymbol(): String
Return this.symbol
Method setName(name: String)
Set this.name to name
Method getName(): String
Return this.name
Method setShares(shares: Integer)
Set this.shares to shares
Method getShares(): Integer
Return this.shares
Method setPricePerShare(price: Float)
Set this.pricePerShare to price
Method getPricePerShare(): Float
Return this.pricePerShare
End Class
Read more about StockTransaction here:
https://brainly.com/question/33049560
#SPJ1
In Java Please
4.24 LAB: Print string in reverse
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text.
Ex: If the input is:
Hello there
Hey
done
the output is:
ereht olleH
yeH
The program that takes in a line of text as input, and outputs that line of text in reverse is given
The Programimport java.util.Scanner;
public class ReverseString {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String line;
do {
line = input.nextLine();
if (!line.equalsIgnoreCase("done") && !line.equalsIgnoreCase("d")) {
String reversed = reverseString(line);
System.out.println(reversed);
}
} while (!line.equalsIgnoreCase("done") && !line.equalsIgnoreCase("d"));
}
public static String reverseString(String text) {
StringBuilder reversedText = new StringBuilder();
for (int i = text.length() - 1; i >= 0; i--) {
reversedText.append(text.charAt(i));
}
return reversedText.toString();
}
}
Read more about programs here:
https://brainly.com/question/30783869
#SPJ1
For this lab activity, the HousingCrunch activity in part 1 will be modified to load housing data from a CSV file instead of having the options manually added to the houseList (also known has hardcoded values). In addition to prompting the user for name and a seed value, the program should also prompt for the filename containing the housing data. The data file will contain more data fields than will be used in this application as we are only interested in the housing data stored in the 1st field of each row. The screenshot below shows a spreadsheet view of the provided CSV data with the first field of each row outlined in red.
MASH Database Spreadsheet
It will be extremely helpful to review the CSVParser Deeper Look Video and Guided Experimentation examples before starting on this activity.
NOTE: In Computer Science we teach students to begin counting at zero because zero is the first index value of arrays, strings and many other programming related things. When working with data from muggles (non-programmer folk), the first data element is often referred to as record 1 or row 1 or column A or field 1. Just open a spreadsheet and look at the column and row identifiers. As programmers it is our responsibility to be aware of this difference and make certain our programs behave correctly.
Expected Program Output (with sample user input)
Please enter your name: Luke
Please enter a seed value: 123
Please enter the filename: MASHDatabase.csv
Hello Luke,
You should buy a shack.
To modify the HousingCrunch program, prompt the user for their name, a seed value, and the filename containing the housing data in CSV format.
How is this so?Load the housing data from the CSV file, extracting only the first field of each row.
Use the user's name, seed value, and the housing data to determine their recommended house option.
Finally, print the personalized recommendation to the console.
Note that CSV format, short for Comma-Separated Values format, is a plain text file format used to store tabular data.
Learn more about program at:
https://brainly.com/question/30783869
#SPJ1