Questions
Design a class named Account that contains: ■ A private int data field named id for...

Design a class named Account that contains:
■ A private int data field named id for the account (default 0).
■ A private double data field named balance for the account (default 0).
■ A private double data field named annualInterestRate that stores the current
interest rate (default 0). Assume all accounts have the same interest rate.
■ A private Date data field named dateCreated that stores the date when the account was
created.
■ A no-arg constructor that creates a default account.
■ A constructor that creates an account with the specified id and initial balance.
■ The accessor and mutator methods for id, balance, and annualInterestRate.
■ The accessor method for dateCreated.
■ A method named getMonthlyInterestRate() that returns the monthly interest rate.
■ A method named getMonthlyInterest() that returns the monthly interest.
■ A method named withdraw that withdraws a specified amount from the account.
■ A method named deposit that deposits a specified amount to the account.
Implement the class in Java as required by the design above. (Hint: The method getMonthlyInterest() is to return monthly interest, not the interest rate. Monthly interest is balance * monthlyInterestRate and monthlyInterestRate is annualInterestRate / 12. Note that annualInterestRate is a percentage, e.g., like 4.5%. You need to divide it by 100.)
Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.

PLEASE DO THE QUESTION IN A SIMPLER WAY

In: Computer Science

Report on hiding information and watermarks in Data security technologies?.

Report on hiding information and watermarks in
Data security technologies?.

In: Computer Science

A company’s IT policy states that passwords should contain 14 characters with a mix of letters,...

A company’s IT policy states that passwords should contain 14 characters with a mix of letters, numbers, and special characters. After reviewing the implemented policy within the IT system, it is noted that the current security settings stated that passwords only need to be 6 character long. Answer the following questions.

What are the threats?
What are the risks?
How would you mitigate the risks?

In: Computer Science

Perform the following base conversion using division and remainder method:4 marks a) 498base10 to base 3...

Perform the following base conversion using division and remainder method:4 marks
a) 498base10 to base 3
b) 2458base10 =
c) 961base10
d) 21base10 to base
3 5 9 7

In: Computer Science

2. [50] Write a C program to count the total number of commented characters and words...

2. [50] Write a C program to count the total number of commented characters and words in a C file taking both types of C file comments (single line and block) into account.

In: Computer Science

This program is written by Ruby and Please rewrite this program as python. input_lines = gets.split("...

This program is written by Ruby and Please rewrite this program as python.

input_lines = gets.split(" ")
tasizan = input_lines[0].to_i
hikizan = input_lines[1].to_i
cnt=-0

drill=[]
while cnt<tasizan
    kazu1 = rand(100)
    kazu2 = rand(100)
    next if kazu1+kazu2>99
    next if drill.include?("#{kazu1} + #{kazu2} =")
    drill.push("#{kazu1} + #{kazu2} =")
    cnt+=1
end
cnt=0
while cnt<hikizan
    kazu1 = rand(100)
    kazu2 = rand(100)
    next if kazu1 <= kazu2
    next if drill.include?("#{kazu1} - #{kazu2} =")
    drill.push("#{kazu1} - #{kazu2} =")
    cnt+=1
end
    puts drill.sample(tasizan+hikizan)

In: Computer Science

Describe the difference between IP and Network Access layer in TCP protocol and also explain the...

Describe the difference between IP and Network Access layer in TCP protocol and also explain the control information embedded in these two layers

In: Computer Science

In C language, Calculate the price of parking: First 60 minutes is Free; 61-80 minites is...

In C language, Calculate the price of parking:
First 60 minutes is Free;
61-80 minites is $4
Each additionat 20 minutes is $2
Maximum rate per day is $18 (24 hrs), so once it passes the 4 hrs to 24hrs parked will be $18
Note: If the input is invalid, print message “invalid input” and exit the program.

Example:

Hrs Parked: 8
Minutes Parked: 20
Price: $18
———————// If its over 24hrs add the previous days plus the new rate
Hrs Parked: 26
Minutes Parked: 28
Price: $34
———————
Hrs Parked: 95
Minutes Parked: 60
Price: $72

In: Computer Science

6. Add using binary addition 26 and 56 45 and 65      7. Subtract using binary...

6. Add using binary addition

  1. 26 and 56
  2. 45 and 65

     7. Subtract using binary two’s complement

  1. 23 from 45
  2. 34 from 65

In: Computer Science

why is a well-defined integrated change control system is so important to project success

why is a well-defined integrated change control system is so important to project success

In: Computer Science

this lab, you will write a shell script, called compare_cols.sh. This program should Read a CSV...

this lab, you will write a shell script, called compare_cols.sh. This program should

  • Read a CSV file from standard input (STDIN).
    • Note that in general, CSV files may contain quoted fields with embedded newlines. But for this assignment you can assume that there are no fields with embedded newlines, and therefore each new line represents a new row of the CSV file.
  • Print a single number (integer) to standard output (STDOUT): the count of the lines in the CSV file for which the first word occurring in column 3 of the CSV also occurs as a word in column 5 of the CSV.
    • For the purposes of this assignment, words are considered to be sequences of non-space characters delimited on either side by spaces or by the beginning/end of the text string.
    • Whitespace surrounding the integer output will be ignored for scoring.For example, in the following CSV row, the word "six" occurs at the beginning of column 3, and also as a word in column 5:
      one two three,four five,six seven,eight,nine six ten,eleven

Bashscript

In: Computer Science

What are IP address classes? Please explain each class and their characteristics.

What are IP address classes?

Please explain each class and their characteristics.

In: Computer Science

What is the difference between a pretest and posttest Do...loop statement? give an example of each...

  1. What is the difference between a pretest and posttest Do...loop statement? give an example of each loop using pseudocode.
  2. What is infinite loop, how to avoid your program runs with an endless loop? give an example using psuedocode or explanation

In: Computer Science

This is the class that needs to be written... import java.util.ArrayList; /** * Deals out a...

This is the class that needs to be written...

import java.util.ArrayList;

/**
* Deals out a game of 5-card-stud.
*
* @author PUT YOUR NAME HERE
* @version PUT THE DATE HERE
*/
public class FiveCardStud
{
private Deck myDeck;
private ArrayList<Hand> players;


/**
* Constructor for objects of class FiveCardStud
*/
/*
Write a constructor for the FiveCardStud class. The constructor
accepts a single integer parameter for the number of players.
The number of players should be from 2 to 6 inclusive.
Make sure to take care of values outside of this range.
For numbers less than 2, set the number to 2 and print
an appropriate message. For numbers greater than 6
set the number to 6 and print an appropriate message.
For each player add a hand to the list of players.
Print out the name of the game.
Don't forget to initialize the fields.
*/

  
/**
* Deal the cards.
*/
/*
Write a method called "deal".
The method should print out a message to let the user know
that the cards have been dealt.
It should remove any old cards from all players hands
from previous games (Hint: there is a fold method in the Hand class.)
It should then shuffle the deck and add 5 cards to each player's hand.
*/
  
  
/**
* Prints out all player's hands.
*/
/*
Write a method called "showCards".
The method should print out each players hand as shown
in the sample output.
*/
}

These are other classes that are already written and do not need to be changed...

import java.util.ArrayList;
import java.util.Iterator;

/**
* Represents a single player's hand in a card game.
*
* @author Derek Green, Mar. 27, 04
* @revised by Allyson Anderson, Nov.1, 06
*/
public class Hand
{
private ArrayList<Card> hand;// contains this players cards

/**
* Constructor for objects of class Hand
*/
public Hand()
{
hand = new ArrayList<Card>();
}
  
/**
* Add a single card to the player's hand.
*/
public void addCard(Card card)
{
hand.add(card);
}
  
/**
* Clear the player's hand.
*/
public void fold()
{
hand.clear();
}
  
/**
* Show the player's cards.
*/
public void displayHand()
{
Iterator<Card> it = hand.iterator();
while(it.hasNext())
{
System.out.println((it.next()).getCard());
}
}
}

import java.util.ArrayList;
import java.util.Iterator;

/**
* Represents a deck of 52 playing cards.
*
* @author Derek Green, Mar. 26, 04
* @revised by Allyson Anderson, Nov. 1, 06
*/
public class Deck
{
private final String[] suits = {"Spades ", "Hearts ", "Clubs ", "Diamonds"};
private final String[] faces = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};

private Card[] card;
private int topCard;
  
/**
* Construct a deck of cards
*/
public Deck()
{
card = new Card[52];
topCard = -1;//deal method will increment topCard
for(int i = 0; i < 52; i++)
{
card[i] = new Card(suits[i/13], faces[i%13]);// brand new deck with all cards in order
}
}
  
/**
* deal() returns the next card or null if the deck is empty.
*/
public Card deal()
{
topCard++;// set topCard to the next card
if(topCard < 52)
{   
return card[topCard];
}
else
{
return null;
}
}
  
/**
* shuffle() randomly generates a sequence of cards for the card array
*/
public void shuffle()
{
topCard = -1;// reset the top card
int nextNumber;
boolean[] available = new boolean[52];// used to select random #'s between 0 and 51 without replacement

for(int i = 0; i < 52; i++)
{
available[i] = true;//all #'s between 0 and 51 are available
}
  
for(int i = 0; i < 52; i++)
{
nextNumber = (int)(Math.random()*52);// select a # from 0 to 51
while(!available[nextNumber])//while nextNumber is not available (i.e. this number has already been used)
{
nextNumber = (int)(Math.random()*52);//try a different number until you find an unused one
}
available[nextNumber] = false;// this number is taken
card[i] = new Card(suits[nextNumber/13], faces[nextNumber%13]);
}
}
  
/**
* Print out the entire deck for testing purposes.
*/
public void testDeck()
{
for(int i = 0; i < 13; i++)
{
System.out.println(card[i].getCard() + "\t" + card[i+13].getCard() + "\t" + card[i+26].getCard() + "\t" + card[i+39].getCard());
}
}
  
/**
* Print out a subset of the deck to test the deal method.
*/
public void testDeal(int cardNumber)
{
ArrayList<Card> hand = new ArrayList<Card>();// hold a hand of cards.
int index = 0;
while(index < cardNumber)
{
hand.add(deal());
index++;
}
  
Iterator<Card> it = hand.iterator();
while(it.hasNext())
{   
Card thisCard = it.next();
System.out.println(thisCard.getCard());
}
}
}

/**
* Represents a single playing card.
*
* @author Derek Green, Mar. 26, 04
* @revised by Allyson Anderson, Nov. 1, 06
*/
public class Card
{
private String suit;
private String face;

/**
* Constructor for objects of class Card.
*/
public Card(String suit, String face)
{
this.suit = suit;
this.face = face;
}

/**
* Returns the suit of the card
*/
public String getSuit()
{
return suit;
}
  
/**
* Returns the face of the card
*/
public String getFace()
{
return face;
}
  
/**
* Returns the suit and face of the card as a single String
*/
public String getCard()
{
return face + "\t" + suit;
}
}

In: Computer Science

Radix sort Come up with an unsorted array of numbers (integer array). Sort the numbers in...

Radix sort
Come up with an unsorted array of numbers (integer array). Sort the numbers in ascending order and descending order and display them using radix sort.

First sort in ascending, then reset the array to its original order and finally sort the array again in descending order.

C++ program
thanks

In: Computer Science