Questions
Please implement Sample string toString()method for each class and return itself a string, not the output....

 Please implement Sample string toString()method for each class and return itself a string, not the output. 
import java.util.ArrayList;

public class Customer extends User{
    private ArrayList orders;

    public Customer(String display_name, String password, String email) {
        super(display_name, password, email);
    }

    @Override
    public String getPermissionLevel() {
        return "CUSTOMER";
    }

    public void addOrder(Order order){
        this.orders.add(order);
    }

    public ArrayList listOrders(){
        return this.orders;
    };
}

----------------

public class ElectronicProduct extends Product{
    private long SNo;
    private String warranty_period;

    public ElectronicProduct(long SNo, String warranty_period, String productId, String productName, String brandName, String Description) {
        super(productId, productName, brandName, Description);
        this.SNo = SNo;
        this.warranty_period = warranty_period;
    }

}

--------------

public class HomeProduct extends Product{

    String location;
    public HomeProduct(String location, String productId, String productName, String brandName, String Description) {
        super(productId, productName, brandName, Description);
        this.location = location;
    }
}

----------------------

import java.util.ArrayList;
import java.util.Date;
public class Order {
    private int order_no;
    private ArrayList products;
    private String order_Status;
    private Date final_date;

    public Order(int order_no, String order_Status, Date final_date) {
        this.order_no = order_no;
        this.order_Status = order_Status;
        this.final_date = final_date;
        this.products = new ArrayList<>();
    }

    public Date getFinal_date() {
        return final_date;
    }

    public String getOrder_Status() {
        return order_Status;
    }

    public int getOrder_no() {
        return order_no;
    }

    public void setFinal_date(Date final_date) {
        this.final_date = final_date;
    }

    public void setOrder_Status(String order_Status) {
        this.order_Status = order_Status;
    }

    public void setOrder_no(int order_no) {
        this.order_no = order_no;
    }

    public ArrayList getProducts(){
        return this.products;
    }

    public void addProduct(Product product){
        this.products.add(product);
    }

}

------------------------------------------------

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;

public class Product {

    private String productId;
    private String productName;
    private String brandName;
    private String description;
    private ArrayList categories;
    private LocalDate dateCatalog;

    public Product(String productId, String productName, String brandName, String description) {
        this.productId = productId;
        this.productName = productName;
        this.brandName = brandName;
        this.description = description;
        this.dateCatalog = LocalDate.now();
        this.categories = new ArrayList<>();
    }

    public String getProductId() {
        return productId;
    }

    public String getDescription() {
        return description;
    }

    public String getProductName() {
        return productName;
    }

    public void addCategory(Category category){
        this.categories.add(category);
    }

    public ArrayList listCategories(){
        return this.categories;
    }
}

--------

 

-----------------------------------------

 

In: Computer Science

Colonial Adventure Tours Case The owner of Colonial Adventure Tours knows that being able to run...

Colonial Adventure Tours Case

  • The owner of Colonial Adventure Tours knows that being able to run queries is one of the most important benefits of using a DBMS. In the following exercises, you will use the data in the Colonial Adventure Tours database shown in Figures 1-15 through 1-19 in Chapter 1. (If you use a computer to complete these exercises, use a copy of the Colonial Adventure Tours database so you will still have the original data when you complete Chapter 3 exercises.) In each step, use QBE to obtain the desired results. You can use the query feature in a DBMS to complete the exercises using a computer, or you can simply write a description of how you would complete the task. Check with your instructor if you are uncertain about which approach to take.
  • Save the file on your computer with your last name in the file name. (Example: case_1-1 _Jones.doc)
  • Click the Choose File button to find and select your saved document.
  1. List the name of each trip that does not start in New Hampshire (NH).
  2. List the name and start location for each trip that has the type Biking.
  3. List the name of each trip that has the type Hiking and that has a distance greater than six miles.
  4. List the name of each trip that has the type Paddling or that is located in Vermont (VT).
  5. How many trips have a type of Hiking or Biking?
  6. List the trip name, type, and maximum group size for all trips that have Susan Kiley as a guide.
  7. List the trip name and state for each trip that occurs during the Summer season. Sort the results by trip name within state.
  8. List the name of each trip that has the type Hiking and that is guided by Rita Boyers.
  9. How many trips originate in each state?
  10. How many reservations include a trip with a price that is greater than $20 but less than $75?
  11. List the reservation ID, customer last name, and the trip name for all reservations where the number of persons included in the reservation is greater than four.
  12. List the trip name, the guide’s first name, and the guide’s last name for all trips that originate in New Hampshire (NH). Sort the results by guide’s last name within trip name.
  13. List the reservation ID, customer number, customer last name, and customer first name for all trips that occur in July 2018.
  14. Colonial Adventure Tours calculates the total price of a trip by adding the trip price plus other fees and multiplying the result by the number of persons included in the reservation. List the reservation ID, trip name, customer’s last name, customer’s first name, and total cost for all trips where the number of persons is greater than four.
  15. Create a new table named Hiking that includes all columns in the Reservation table where the trip type is Hiking.
  16. Use an update query to change the OtherFees value in the Hiking table to $5.00 for all records on which the OtherFees value is $0.00.
  17. Use a delete query to delete all trips in the Hiking table where the trip date is 6/12/2018.
  18. One of the reservations agents at Colonial Adventure Tours created the query shown in Figure 2-49 to list each trip name and the last name and first name of each corresponding guide. The query results included 410 records, and he knows that this result is incorrect. Why did he get so many records? What should he change in the query design to get the correct query results?

In: Computer Science

Need SQL commands for these questions based on the bowling league database; When was the first...

Need SQL commands for these questions based on the bowling league database; When was the first tournament date and where was it played? What are the number of tournaments per location?

In: Computer Science

Q 1.8 : Sorting is a popular method to access "traditional data" rapidly. Why is it...

  • Q 1.8 : Sorting is a popular method to access "traditional data" rapidly. Why is it difficult to sort spatial data?

In: Computer Science

In python Using the example code from the HangMan program in our textbook, create a Word...

In python Using the example code from the HangMan program in our textbook, create a Word Guessing Game of your choice. Design a guessing game of your own creation. Choose a theme and build your words around that theme. Keep it simple.

Note: I would highly recommend closely reviewing the HangMan code and program from Chapter 10 before starting work on this project. You can run the program via my REPL (Links to an external site.).

Using python Similar to our Number Guessing game, be sure to allow the player the option to keep playing and keep score. You can design the game however you see fit but it must meet these requirements:

General Requirements

  • Remember to comment your code - include your name, date, class, and assignment title.
  • Provide comments throughout your program to document your code process.
  • Create a greeting/title to your program display output.
  • Your program should ask the player if they wish to play again.
  • Be creative! Have fun with this. Don't overthink it.

Word lists

  • You must have wordlists totaling at least 30 words to select from divided into themes or topics that you have identified. For example, say your words are all related to United States state names and world country names. You might choose to have one list named statelist and one list named countrylist. Each list might contain 15 words. Break these themes/topics into whatever works best but be sure to have at least a total of 30 words to work from.
  • Your game should randomly choose one of the words in the wordlists.

Output in python test and paste code

  • The player should be given the theme/topic of the word.
  • The player should be told how many letters the word contains.
  • The player should be shown a list of the letters that they have guessed already.
  • Output the correct guesses and location of the letters in the word. For example say the word is banana. The user has guesses the letter A as their first guess. Your output will display something like _ a _ a _ a so that the player can guess the word.
  • Your program should keep score of wins/losses and display them to the player.

Guesses in python code show

  • The player should be given ten guesses. *Note depending on the complexity of your theme/topic area you may wish to modify the maximum guesses.
  • The program should ask for a letter guess. Validate that the player inputs only 1 letter in their guess. Handle other inputs with feedback and a request to try again.
  • Your program should REMOVE the word they just played from the wordlist so they do not get the same word twice.

Think the program through

Break this down into smaller sized concepts first. Walk through the program functions step by step. Here is some of my thought processes to get you started. Thank you for helping me

  • First create your word lists and organize them by theme/topic. Maybe I want my game to be "Things You Find in a Grocery Store" and I will have 3 lists - fruits, vegetables and proteins. I will create each of my list structures and come up with 10 words for each list. fruits =["banana", "apple", "grapes", "orange", "pear", "peach", "plum"] etc.
  • Then I will try to randomly select an index from my list. I can use the random module to help me and get a value between 0 and the length of the list -1 (to take into account that the index starts at 0).
  • Once I have that part of the program working, I would celebrate my win and take a little break.
  • Next, I will store the random word from my list to a variable so that I can compare the input guesses against that word. This is where I will need to make use of string functions from Chapter 10 and use the Hangman code for inspiration.
  • I would use string functions like find() to search and find if the letter guess found a match.
  • If a match was found, I would print out a message.
  • If a match wasn't found, I would print out a message, and store the guessed letter to a list.
  • I would then output the word with the correctly guessed letters in the position they should be in.
  • and so on... until the game worked and produced the correct output.


  • Here is the book hangman code to refere to:

    import wordlist

    # Get a random word from the word list
    def get_word():
    word = wordlist.get_random_word()
    return word.upper()

    # Add spaces between letters
    def add_spaces(word):
    word_with_spaces = " ".join(word)
    return word_with_spaces

    # Draw the display
    def draw_screen(num_wrong, num_guesses, guessed_letters, displayed_word):
    print("-" * 79)
    print("Word:", add_spaces(displayed_word),
    " Guesses:", num_guesses,
    " Wrong:", num_wrong,
    " Tried:", add_spaces(guessed_letters))

    # Get next letter from user
    def get_letter(guessed_letters):
    while True:
    guess = input("Enter a letter: ").strip().upper()
      
    # Make sure the user enters a letter and only one letter
    if guess == "" or len(guess) > 1:
    print("Invalid entry. " +
    "Please enter one and only one letter.")
    continue
    # Don't let the user try the same letter more than once
    elif guess in guessed_letters:
    print("You already tried that letter.")
    continue
    else:
    return guess

    # The input/process/draw technique is common in game programming
    def play_game():
    word = get_word()
      
    word_length = len(word)
    remaining_letters = word_length
    displayed_word = "_" * word_length

    num_wrong = 0   
    num_guesses = 0
    guessed_letters = ""

    draw_screen(num_wrong, num_guesses, guessed_letters, displayed_word)

    while num_wrong < 10 and remaining_letters > 0:
    guess = get_letter(guessed_letters)
    guessed_letters += guess
      
    pos = word.find(guess, 0)
    if pos != -1:
    displayed_word = ""
    remaining_letters = word_length
    for char in word:
    if char in guessed_letters:
    displayed_word += char
    remaining_letters -= 1
    else:
    displayed_word += "_"
    else:
    num_wrong += 1

    num_guesses += 1

    draw_screen(num_wrong, num_guesses, guessed_letters, displayed_word)

    print("-" * 79)
    if remaining_letters == 0:
    print("Congratulations! You got it in",
    num_guesses, "guesses.")   
    else:
    print("Sorry, you lost.")
    print("The word was:", word)

    def main():
    print("Play the H A N G M A N game")
    while True:
    play_game()
    print()
    again = input("Do you want to play again (y/n)?: ").lower()
    if again != "y":
    break

    if __name__ == "__main__":
    main()

In: Computer Science

Quiz for Cartography 1. Which map element (e.g., LASTDOG + PADS) documents the overall purpose of...

Quiz for Cartography


1. Which map element (e.g., LASTDOG + PADS) documents the overall purpose of a map?
(a) Legend (b) Author (c)Scale (d) Title (e) Date (f) Orientation (g) Grid
(h) Map Projection (i) Positional Accuracy (j) Geodetic Datum (k) Data Sources

2. Which map elements (e.g., LASTDOG + PADS) are missing from Google Maps?
(a) Legend (b) Author (c)Scale (d) Title (e) Date (f) Orientation (g) Grid
(h) Map Projection (i) Positional Accuracy (j) Geodetic Datum (k) Data Sources

3. Which is true about a given point P (e.g., Mount Everest) on the surface of Earth?
(a) P has a unique (latitude, longitude).
(b) Given a map projection (e.g., Mercator), P has a unique (latitude, longitude).
(c) Given a geodetic datum, P has a unique (latitude, longitude).
(d) Given a time and a geodetic datum, P has a unique (latitude, longitude).
(e) Latitude and longitude for P vary over 100m across different Geodetic datum
(f) Major earthquakes may change Latitude and longitude for P by several meters

4. Which is true about the North determined by a (stationary) compass (or a compass app)?
(a) Away from poles, it points towards the North Star (Polaris) in the sky.
(b) Away from poles, it points towards the true north (direction along a longitude towards the geographic North Pole).
(c) Away from poles, it points towards the magnetic (north) pole.
(d) At magnetic pole, it points towards the true north.
(e) At geographic North Pole, it points towards the magnetic pole.

5. Which spatial relationships are preserved by a topological map, e.g., sub-way maps?
(a) connectivity between stations via train lines
(b) distances between stations along train lines
(c) absolute geographic direction (e.g., north, east) between stations
(d) relative direction between stations along train lines

6. Choropleth maps show statistical data aggregated over previously defined regions (e.g.,
states, countries). In contrast, Isarithmic maps define region
boundaries based on data. Divide the following maps into either Choropleth or Isarithmic:
(a) Topographic maps showing iso-elevation contours
(b) Census maps
(c) Election Map to convey results of an Election
(d) Weather forecast maps showing areas of sunshine, clouds, rain, snow, ...
(e) Accessibility map showing commute time to a city center
(f) Hotspot map showing elliptical regions of unusually high density of disease (or crime)
(f) Google map app showing a phone's location as a standard deviation circle around a mean point (center point)

7. Which font properties are used in text labels to denote fluid nature of water bodies?
(a) Serif fonts (a) San Serif fonts (c) Italics (d) Blue color

8. Which is not a common characteristic of a well-designed cartographic map?
(a) clarity and legibility (b) order (c) beauty (d) realism
(d) balance (e) Unity and Harmony (f) visual hierarchy (g) visual contrast

9. Match colors to map layers in common maps:
(a) Colors are black, blue, brown, green, red, yellow
(b) Map layers include arid areas, forests, mountains, place names, sea surface temperature, water

10. Consider a map for wind energy farm development. Classify the following map layers into
foreground and background for this map: country boundaries, roads, lakes, place names, transmission lines, wind-mills.

In: Computer Science

For this assignment, you will apply what you learned in analyzing Java™ code so far in...

For this assignment, you will apply what you learned in analyzing Java™ code so far in this course by writing your own Java™ program. The Java™ program you write should do the following:

  • Accept user input that represents the number of sides in a polygon. Note: The code to do this is already written for you.
  • If input value is not between 3 and 5, display an informative error message
  • If input value is between 3 and 5, use a switch statement to display a message that identifies the correct polygon based on the number of sides matching the input number (e.g., triangle, rectangle, or polygon)

Complete this assignment by doing the following:

  1. Download tnd unzip ahe linked Week Two Coding Assigment Zip File.
  2. Read the file carefully, especially the explanatory comments of what the existing code does.
  3. Add your name and the date in the multi-line comment header.
  4. Refer to the following linked Week Two Recommended Activity Zip File to see examples of how to code all of the Java™ statements (i.e., switch, println(), and if-then-else) you will need to write to complete this assignment.
  5. Replace the following lines with Java code as directed in the file:
  • LINE 1
  • LINE 2
  1. Comment each line of code you add to explain what you intend the code to do.
  2. Test and modify your Java™ program until it runs without errors and produces the results as described above.

Program Summary: This program demonstrates these basic Java concepts:
* - defining variables of different types
* - if-then and if-then-else logic
* - constructing a string to display onscreen
* - switch logic
*
* To complete this assignment, you will add code where indicated. The
* behavior of your completed assignment should be to accept an input
* value for the number of sides of a two-dimensional figure. Based on that value,
* your code should display the type of figure that corresponds to the number of polygon angles
* indicated (3=triangle, 4=rectangle, etc.)
*
* Here are the specific requirements:
*
* After the user types in a value from 3 to 5 inclusive (i.e., 3, 4, or 5):
*
* 1. Your code determines whether the input value is out of range (less than 3 or more than 5)
* and, if so, displays a meaningful error message on the screen and ends the program.
*
* 2. Because you will be comparing a single expression (the input value) to multiple constants (3, 4, and 5),
* your code should use a switch statement to display the following message onscreen:
*
* If user inputs 3, onscreen message should say "A triangle has 3 sides."
* If user inputs 4, onscreen message should say "A rectangle has 4 sides."
* If user inputs 5, onscreen message should see "A pentagon has 5 sides."
*
* 3. Be sure to test your program. This means running your program multiple
* times with test values 3, 4, 5, as well as at least two values that fall outside that range
* (one lower than the lowest and one higher than the highest) and making sure
* that the correct message displays for each value you input. Also be sure
* that running your program does not cause any compiler errors.
***********************************************************************/
package week2codingassignment;

import java.util.Scanner;

public class PRG420Week2_CodingAssignment {

public static void main(String[] args) {

String userInputStringOfAngles; // Declare a variable of type String to capture user input
int numberOfAngles; // Declare a variable of type int to hold the converted user input

Scanner myInputScannerInstance = new Scanner(System.in); // Recognize the keyboard
System.out.print("Please type the integer 3, 4, or 5 and then press Enter: "); // Prompt the user
userInputStringOfAngles= myInputScannerInstance.next(); // Capture user input as string
numberOfAngles = Integer.parseInt(userInputStringOfAngles); // Convert the string to a number in case this will be useful later
  
// LINE 1. CODE TO DETERMINE WHETHER USER INPUT IS OUT OF BOUNDS GOES HERE
  
  
// LINE 2. SWITCH CODE TO PRINT CORRECT "SHAPE" MESSAGE BASED ON USER INPUT GOES HERE
  

}
}

In: Computer Science

Information. in java Consider a banking system with 3 classes:  BankAccount, CheckingAccount, and SavingsAccount, that you are...

Information. in java Consider a banking system with 3 classes:  BankAccount, CheckingAccount, and SavingsAccount, that you are to design and write. Have CheckingAccount and SavingsAccount inherit from BankAccount. In BankAccount, you should include an account number, an account balance, a deposit method, a toString method, and an abstract withdraw method. Since deposits work the same way in both child classes, make sure they cannot override it. The constructor should only take an initial deposit and generate a random 5 digit account number. The toString should display the account number and the balance.

In the CheckingAccount class add a minimum balance and a standard overdraft fee of $25. Implement the withdraw method so that overdrafts are allowed, but the overdraft fee is incurred if the balance drops below the minimum balance. Override the toString method to display everything the BankAccount toString displays plus the minimum balance. Use the parent class toString to do most of the work.

In the SavingsAccount class add an annual interest rate (with a default value of 1.5%) and a method to recalculate the balance every month. Since the interest rate is annual, make sure to calculate the interest accordingly. Override the toString method to display everything the BankAccount toString displays plus the interest rate. Like the CheckingAccount toString, you should use the parent class to do most of the work.

question. Write the Java implementation of the SavingsAccount. Note: no driver is required.

In: Computer Science

Building a Prime Factorization Factory It is common, and smart, in computing to build upon work...

Building a Prime Factorization Factory

It is common, and smart, in computing to build upon work that you or others have done previously, rather than re-inventing the wheel. In this project, you will build on some functions defined in the class slides and in the book.  Of course, in this class you should never use work that you find on the internet or done by anyone other than youself, except as specifically allowed, as in this case!

Many of the examples we've done in class have involved dealing with prime numbers: decide whether a number is a prime, find the next prime, print the first 100 primes, etc. The concept of a prime number is fundamental in mathematics, particularly in number theory. In fact, the fundamental theorem of arithmetic states that every positive integer (greater than 1) can be represented uniquely (order doesn't matter) as a product of one or more primes. Your task in this project is to write a library of functions to deal with primes including finding the prime factorization of arbitrary positive integers.

Assignment:

When the program begins it should print the message ``Welcome to the Prime factory!'' Then, accept from the user a command, which can be one of the following: factor, isprime, or end. Case does not matter for this command. Example: end, EnD, and END should all behave identically. (You don't have to preserve the case of the input string in error messages.) If the user enters anything else, print an error message. See the examples below.

If the user enters factor, prompt for an integer greater than 1. You can assume that the input is an integer, but don't assume it is greater than 1. If it's not, print an error message and return to the top level loop (i.e., back to prompting for a command). If an integer greater than 1 is entered, compute and print its prime factorization as a list. See the examples below.

If the user enters isprime, prompt for an integer. You can assume that the input is an integer. If the supplied value is less than 2, print an error message and return to the top level loop. Otherwise, check whether the input is prime and print an appropriate message. See the examples below.

Finally, if the user enters end, print the message ``Thanks for using our service!'' and exit.

Put a blank line between each round of interaction to make the output more readible.

Expected Output:

Below is some sample output for this program. You should match this exactly.

> python Project2.py
Welcome to the Prime factory!

Enter a command (factor, isprime, end): fector
Command fector not recognized. Try again!

Enter a command (factor, isprime, end): fAcToR
Enter an integer > 1: 1000
The prime factorization of 1000 is: [2, 2, 2, 5, 5, 5]

Enter a command (factor, isprime, end): facTOR
Enter an integer > 1: 213
The prime factorization of 213 is: [3, 71]

Enter a command (factor, isprime, end): factor
Enter an integer > 1: -23
Illegal input: -23; input must be an integer > 1.

Enter a command (factor, isprime, end): factor 100
Command factor 100 not recognized. Try again!

Enter a command (factor, isprime, end): factor
Enter an integer > 1: 1009
The prime factorization of 1009 is: [1009]

Enter a command (factor, isprime, end): isPRIME 
Enter an integer > 1: 1009
The number 1009 is prime

Enter a command (factor, isprime, end): ISprime 213
Command isprime 213 not recognized. Try again!

Enter a command (factor, isprime, end): ISprime 
Enter an integer > 1: 213
The number 213 is not prime

Enter a command (factor, isprime, end): IsPrime
Enter an integer > 1: -23
Illegal input: -23; input must be an integer > 1.

Enter a command (factor, isprime, end): isPrime?
Command isprime? not recognized. Try again!

Enter a command (factor, isprime, end): EnD
Thanks for using our service! Goodbye.
>

In: Computer Science

What is the difference between IP and MAC address on a PC? What command would you...

What is the difference between IP and MAC address on a PC? What command would you type that will give you both IP and MAC information.

In: Computer Science

1) Given an array queue implementation with one unused entry and frontIndex and backIndex references, match...

1) Given an array queue implementation with one unused entry and frontIndex and backIndex references, match the status of the queue with the following information about frontIndex and backIndex for a queue with capacity of 5:

a.) frontIndex is 0 and backIndex is 4

b.) frontIndex is 1 and backIndex is 4

c.) frontIndex is 3 and backIndex is 0

empty queue

one element in the queue

three elements in the queue

four elements in the queue

five elements in the queue

six elements in the queue

invalid

Please Help!

In: Computer Science

We saw that Quicksort actually won’t be “quick” when it attempts to sort some types of...

We saw that Quicksort actually won’t be “quick” when it attempts to sort some types of inputs (e.g., it will take O(n2) time to sort n numbers that are already sorted). List two different ways to improve Quicksort so that it will run “quickly” (on average, in linear time) regardless of the characteristics of the input pattern.

In: Computer Science

2. Write a c++ program that takes from the user the ​number of courses​ and constructs...

2. Write a c++ program that takes from the user the ​number of courses​ and constructs 3 ​dynamic 1D arrays​ with size courses+1. Each array represents a student. Each cell in the array represents a student’s mark in a course. In the last cell of each 1D array you should calculate the average mark of that student. Then output the average mark of all students in each course. Delete any allocated memory. Example Number of courses : 4 50 60 70 20 100 90 80 70 80 90 100 30 Output: 50 60 70 20​ 50 100 90 80 70 ​85 80 90 100 30 ​75 Avg of course 1 = 76.66 Avg of course 2 = 80 Avg of course 3 = 83.33 Avg of course 4 = 40.

In: Computer Science

Information: Consider a banking system with 3 classes:  BankAccount, CheckingAccount, and SavingsAccount, that you are to design...

Information:

Consider a banking system with 3 classes:  BankAccount, CheckingAccount, and SavingsAccount, that you are to design and write. Have CheckingAccount and SavingsAccount inherit from BankAccount. In BankAccount, you should include an account number, an account balance, a deposit method, a toString method, and an abstract withdraw method. Since deposits work the same way in both child classes, make sure they cannot override it. The constructor should only take an initial deposit and generate a random 5 digit account number. The toString should display the account number and the balance.

In the CheckingAccount class add a minimum balance and a standard overdraft fee of $25. Implement the withdraw method so that overdrafts are allowed, but the overdraft fee is incurred if the balance drops below the minimum balance. Override the toString method to display everything the BankAccount toString displays plus the minimum balance. Use the parent class toString to do most of the work.

In the SavingsAccount class add an annual interest rate (with a default value of 1.5%) and a method to recalculate the balance every month. Since the interest rate is annual, make sure to calculate the interest accordingly. Override the toString method to display everything the BankAccount toString displays plus the interest rate. Like the CheckingAccount toString, you should use the parent class to do most of the work.

Question:   Write the Java implementation of the BankAccount. Note, no driver is required.

In: Computer Science

I am new to socket programming and I wish to know what these lines of code...

I am new to socket programming and I wish to know what these lines of code do. I know they are creating UDP sockets, but it would help if someone explained what the code means. Thank you.

Python Code:

import socket

testingSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
testingSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
testingSocket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
testingSocket.bind(('0.0.0.0', 50000))
send_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
send_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
receiving_thread = Thread(target=self.receivingFunction)
send_thread = Thread(target=self.sendMessage)
broadcast_online_status_thread = Thread(target=onlineStatus)

In: Computer Science