Questions
You are a personal financial advisor and you frequently need to tell individuals how many years...

You are a personal financial advisor and you frequently need to tell individuals how many years it will take them to reach their retirement goals given their returns on their various accounts. You plan to write a Python program that helps you calculate these returns.

You must take in three pieces of input:

  • Starting balance amount as an integer or float (how much money you wish to start a savings/market account with)
  • The APR as a float (the percentage return as a decimal, i.e. 0.04 for 4 percent)
  • The goal as an integer or float (this is basically the amount of money we want to reach before stopping)

Given those inputs above, we need to write a loop (we don't know how many iterations) that will continue to add our interest to our balance, until we've reach our goal, at which point the looping stops. We want to know how many years (iterations) it took to reach this goal, so keep track of a count each iteration of the loop.

To add interest to a balance you can think of a balance variable called b and we would use the following math:

b = b + b * apr

If the APR is a deciaml 0.04, then 100 * 0.04 becomes 4... thus our first year earned us 4 dollars making our balancing 104.

Print out the balance and the year each iteration of the loop. See the example screenshot below:

In: Computer Science

3.6 Contrasting and explaining general application concepts and uses Single-platform software Cross-platform software Licensing Software installation...

3.6 Contrasting and explaining general application concepts and uses

  • Single-platform software
  • Cross-platform software
  • Licensing
  • Software installation best practices

4.1 Comparing and contrasting programming language categories

  • Interpreted
  • Compiled programming languages
  • Query languages
  • Assembly language

In: Computer Science

C++ Classes & Objects Create a class named Student that has three private member: string firstName...

C++

Classes & Objects

Create a class named Student that has three private member: string firstName string lastName int studentID

Write the required mutator and accessor methods/functions (get/set methods) to display or modify the objects.

In the 'main' function do the following (1) Create a student object "student1".

(2) Use set methods to assign

  • StudentID: 6337130
  • firstName: Sandy
  • lastName: Santos

(3) Display the students detail using get functions in standard output using cout:

Sandy Santos 6337130 

In: Computer Science

Two coding challenges this week! Part 1: Estimate the value of e. e is defined as  as...

Two coding challenges this week!

Part 1: Estimate the value of e.

e is defined as  as n goes to infinity. So the larger the value of n, the closer you should get to e.

math.e is defined as 2.718281828459045

You'll write a program that uses a while loop to estimate e to within some defined error range, while having a limit on how many iterations it will attempt.

Part 2: Palindrome detection

A palindrome is a string that is the same forwards and backwards.

Madam I'm Adam
Racecar
Was it a cat I saw?

There are many sophisticated ways of detecting palindromes. Some are surprisingly simple (s == s[::-1])

You will use a for loop to iterate over the contents of the string to determine if it is a palindrome.

Beware! There are many solutions online. Don't fall prey to looking this one up. It's not as hard as it looks. Draw it out on paper first and think through how you index the string from both ends.

In: Computer Science

write a program in C Write a function that is passed an array of characters containing...

write a program in C

Write a function that is passed an array of characters containing letter grades of A, B, C, D, and F, and returns the total number of occurrences of each letter grade. Your function should accept both lower and upper case grades, for example, both 'b' and 'B' should be bucketed into your running total for B grades. Any grade that is invalid should be bucketed as a grade of 'I' for Incomplete. You must use a switch statement, and your function should accept an array of any size. Feel free to pass in the array size as a parameter so you know how many grade values you'll need to check in your loop. For example, if you passed a function the following array: char grades [ ] = {'A', 'b', 'C', 'x', 'D', 'c', 'F', 'B', 'Y', 'B', 'B', 'A'}; It would return the following information within a structure (gradeTotals) to the calling function. Grade Total --------- ------ A 2 B 4 C 2 D 1 F 1 I 2 Hint: Design the function as: struct gradeTotals gradeCount (char gradeArray [ ], int arraySize)

In: Computer Science

Write a full project report: Fruit Detection System Using Neural Networking. (following this procedure -Abstract Introduction,...

Write a full project report: Fruit Detection System Using Neural Networking. (following this procedure -Abstract
Introduction, Methodology, Dataset, CNN-TensorFlow, Experimental Result, Conclusion, Future Work, Reference)

N.B. If you don't finish the answer here fully, after I can submit another part here like Dataset, CNN. Make sure you should answer properly part by part.

In: Computer Science

wirte a program in java Part I     Internet Service Provider An Internet service provider has three...

wirte a program in java

Part I     Internet Service Provider

An Internet service provider has three different subscription packages for its customers:

Package A: For $9.95 per month 10 hours of access are provided. Additional hours

are $2.00 per hour.

Package B: For $13.95 per month 20 hours of access are provided. Additional hours

are $1.00 per hour.

Package C: For $19.95 per month unlimited access is provided.

Write a program that calculates a customer’s monthly bill. It should ask the user to enter

the letter of the package the customer has purchased (A, B, or C) and the number of hours

that were used. It should then display the total charges.

Part 2   Internet Service Provider

Modify the program you wrote for Programming in part 1 so it also calculates and

displays the amount of money Package A customers would save if they purchased Package

B or C, and the amount of money Package B customers would save if they purchased Package If there would be no savings, no message should be printed.

use printf for output and no arrays

In: Computer Science

Python Clean up the code Recall that once a subclass inherits from a parent class, it...

Python

Clean up the code

Recall that once a subclass inherits from a parent class, it automatically has access to all of the parents' methods. Sometimes, the subclass needs to do extra things within a method which the parent does not do. For example, both UserPlayer and BasicMonster have their specialized __init__ methods which override the one from Player. Discuss the following question with your partner: What are the other methods that are being overridden by a subclass in the set of classes you've been given?

Some of these methods are not necessary to override. Clean up your classes by moving the methods that could just be put in the Player class up into the Player class

and remove any unneeded repetition of these methods within subclasses.

import random
import time

class Player:
'''
The Player class includes things that every player has,
which is name and hp (health points).
'''

def __init__(self, name: str, hp: int, strength: int) -> None:
self.name = name
self.hp = hp
self.strength = strength
  
class UserPlayer(Player):
'''
UserPlayer inherits from Player, because it is a more specific
type of Player. This type of Player is controlled by the user.
'''
  
def __init__(self, name: str) -> None:
'''
Construct a UserPlayer with the given name, and a set
hp and strength. Also define mp for magic, a list
of possible moves they can make, and an inventory
dictionary of items they can use.
'''

super().__init__(name, 50, 10) # assign attributes name, hp, strength
  
self.mp = 50
self.moves = ['attack', 'magic attack', 'defend']
self.inventory = {'potion': 1, 'ether': 1} # potion should restore hp, ether restores mp

def attack(self, other: 'Player') -> None:
'''
Attack the Player <other> by calling that Player's take_hit method.
The attack power is based on your own strength.
'''
  
other.take_hit(self.strength)

def take_hit(self, strength: int) -> None:
'''
Lose some hp based on the <strength> given.
Print message about how much hp you lost.
'''
  
power = random.randint(strength//2, strength)
print("{} was attacked, and lost {} hp.".format(self.name, power))
self.hp = self.hp - power

def magic_attack(self, other):
pass

def defend(self):
pass
  
def make_move(self, opponent: 'Player') -> None:
'''
Make a move based on user input.
'''
  
not_valid = True
while not_valid:
move = input("What move do you want to take? a: attack, m: magic, d: defend\n")
not_valid = False
if move == "a":
self.attack(opponent)
elif move == "m":
self.magic_attack(opponent)
elif move == "d":
self.defend()
else:
print("Invalid input. Try again.")
not_valid = True

class Monster(Player):
'''
Monster class represents a Computer controlled player.
The make_move method is thus different for the Monster,
where the move is randomly chosen based on a randomly
generated number, rather than through user input.
'''
  
def make_move(self, opponent):
move = self.moves[random.randint(0, len(self.moves)-1)]
if move == "basic attack":
self.attack(opponent)
elif move == "special attack":
self.special_attack(opponent)
  
class BasicMonster(Monster):
'''
BasicMonster class represents a basic type of Monster.
We inherit the make_move from the Monster class, and this
BasicMonster only has those two moves, so we don't need
to add the make_move method here again.
'''
  
def __init__(self) -> None:
'''
Construct a BasicMonster with a name, hp, strength
and list of moves.
'''
  
super().__init__('Basic Monster', 50, 10) # assign attributes name, hp, strength
# the super call above uses the original Player class's init method

self.moves = ['basic attack']

# Question: What does the following code do?
if self.hp < 25:
self.moves.append = ['special attack']

def attack(self, other: 'Player') -> None:
'''
Attack the Player <other> by calling that Player's take_hit method.
The attack power is based on your own strength.
'''
  
other.take_hit(self.strength)

def take_hit(self, strength: int) -> None:
'''
Lose some hp based on the <strength> given.
Print message about how much hp you lost.
'''
  
power = random.randint(strength//2, strength)
print("{} was attacked, and lost {} hp.".format(self.name, power))
self.hp = self.hp - power
  
def special_attack(self, other):
'''
Attack the Player <other> with a special attack that exceeds
your usual strength.
'''

power = random.randint(strength, strength*2)
other.take_hit(40)
  
class Game:

def __init__(self, p1: 'Player', p2: 'Player') -> None:
'''
Construct a Game with the given players.
'''
self.players = (p1, p2)
self.turn = 0 # keep track of whose turn it is out of the two players

def whose_turn(self, count: int) -> 'Player':
'''
Return the Player whose turn it is.
'''
if count % 2 == 0:
next_player = self.players[0]
else:
next_player = self.players[1]
return next_player

def play_game(self) -> None:
'''
Play the game, with each player taking turns making a move, until
one player runs out of hp.
'''
  
# print out the starting state of the game
print(self)
print('------------')
  
winner = None
while (not winner):
if (self.players[0].hp <= 0):
winner = self.players[1]
elif (self.players[1].hp <= 0):
winner = self.players[0]
else:
# if no one has won yet, play one turn of the game (one player makes one move)
self.play_one_turn()
  
print('And {} is the winner!!!'.format(winner.name))

def play_one_turn(self) -> None:
'''
Play one turn of the game based on which player's turn it is.
Print state of game that results from this turn.
'''
  
current_player = self.whose_turn(self.turn) # get the Player whose turn it currently is
other_player = self.whose_turn(self.turn-1) # get the other Player in the game

print("{}'s TURN".format(current_player.name))

# if the player is the computer, wait 2 seconds before
# showing the player's move to make the gameflow feel more natural
if (isinstance(current_player,Monster)):
time.sleep(1)
  
current_player.make_move(other_player)
  
# print current state of game
print(self)
print('------------')
  
self.turn += 1

def __str__(self) -> str:
'''
Return string representation of state of game.
'''
  
return "Player 1 hp: {}, Player 2 hp: {}".format(self.players[0].hp, self.players[1].hp)

def main():
'''Prompt the user to configure and play the game.'''

name = input("What is p1's name? ")
  
p1 = UserPlayer(name) # make the first player a User at position (0,0)

p2 = BasicMonster()
  
g = Game(p1, p2)
g.play_game()

if __name__ == '__main__':
main()
  

In: Computer Science

Problem 1. Suppose we have 4 memory modules instead of 8 in Figures 4.6 and 4.7....

Problem 1. Suppose we have 4 memory modules instead of 8 in Figures 4.6 and 4.7. Draw the memory modules with the addresses they contain using:

a) High-order Interleaving and

b) Low-order interleaving.

In: Computer Science

. After an RODC gets stolen along with a few other computers, Shania, the system administrator,...

.

After an RODC gets stolen along with a few other computers, Shania, the system administrator, resets the computer accounts of the stolen computers that were cached on the RODC. She accomplishes this task by using the Reset all passwords for computer accounts that were cached on this Read-only Domain Controller option.

Which of the following is true of this scenario?

In: Computer Science

Try to make it as simple as you can. Please provide the answers with some examples...

Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.

11-Which of the following do all domains in the same forest have in common? (Choose all that apply.)

a) The same domain name   

b) The same schema

c) The same user accounts   

d) The same global catalog  

12-Which of the following is a valid reason for using multiple forests?

a) Centralized management    

b) Need for different schemas

c) Easy access to all domain resources    

d) Need for a single global catalog   

13-Which of the following is a reason for establishing multiple sites? (Choose all that apply)

a) Improving authentication efficiency     

b) Enabling more frequent replication  

c) Reducing traffic con the WAN     

d) Having only one IP subnet   

14-Which of the following are valid reasons why administrators might want to install their Windows Server 2012 servers using the Server Core option? (Choose all that apply)

a.A Server Core installation can be converted to the full GUI without reinstalling the operating system.

b.The PowerShell 3.0 interface in Windows Server 2012 includes more than 10 times as many cmdlets as PowerShell 2.0

c.The new Server Manager in Windows Server 2012 make it far easier to administer servers remotely

d.A Windows Server 2012 Server Core license costs significantly less than a full GUI license.

15-Windows Server 2012 requires what processor architecture?

a) 64-bit processor only

b) 32-bit processor and 64-bit processor

c) Any processor provided it is physical, not virtual

d) Minimum dual-core processor

16-Which features must you remove from a full GUI installation of Windows Server 2012 to convert it to a Server Core Installation? (Choose all that apply)

a.

Windows Management Instrumentation  

b.

Graphical Management Tools and Infrastructure

c.

Desktop Experience

d.

Server Graphical Shell

17-What client applications utilize Domain Name System (DNS) to resolve host names into IP addresses?

a.

Client web browser, or any application that uses HyperText Transfer Protocol (HTTP) use DNS to resolve host names into IP addresses

b.

All Internet applications working with host names must use DNS to resolve host name into IP addresses

c.

Any application on a system that has connectivity to the Internet use DNS to resolve host names into IP addresses

d.

DNS does not resolve host names into IP addresses.

18-Which of the following does an Active Directory client use to locate objects in another domain?

  1. DNS
  1. Global Catalog
  1. DHCP
  1. Site Link

19-What the default trust relationship between domains in one forest?

a.

Two-way trust relationship between domain trees

b.

By default, no trust relationship between domain trees

c.

One-way trust relationship between domain trees

d.

Each domain tree trusts the forest, but not between each other

20-You are planning an Active Directory implementation for a company that currently has sales, accounting, and marketing departments. All department heads want to manage their own users and resources in Active Directory. What features will permit you to set up Active Directory to allow each manager to manage his or her own container but not any other container?

a.

Delegation of control

b.

Read-only domain controller

c.

Multimaster replication

d.

SRV records

In: Computer Science

JAVA program Create a class called Array Outside of the class, import the Scanner library Outside...

JAVA program

Create a class called Array

Outside of the class, import the Scanner library

Outside of main declare two static final variables and integer for number of days in the week and a double for the revenue per pizza (which is $8.50).

Create a method called main

Inside main:

  1. Declare an integer array that can hold the number of pizzas purchased each day for one week.
  2. Declare two additional variables one to hold the total sum of pizzas sold in a week and one to hold the average pizzas sold per day
  3. Instantiate a Scanner object
  4. Using an appropriate loop, ask the user to enter in the number of pizza for each day
    1. The program must test the entry value.
    2. If the number entered is negative, the program must display an error message and allow for the reentry of the value for that day. The program will continue to ask for a valid response until a valid response is entered.
    3. If the number is valid (greater than or equal to zero), the program will then prompt for the next value until the loop ends.
    4. Extra Credit will be given if the validation test is done via a method call.
  5. Send the array to a method that displays a title for the report as well as the number of pizzas sold for each day.
  6. Send the array to a method that calculates the sum total of pizzas sold for the week; the method returns the sum total back to main().
  7. Send the array to a method that calculates the average number of pizzas sold for the week; the method returns the average back to main().
  8. Display the following:
    1. The total number of pizzas sold for the week
    2. The average number of pizzas sold per day
    3. The total revenue from the pizza sold for the week
    4. The average revenue per day
  9. Display a thank you/goodbye message.
  10. Comment your code.

Screen Shots:

Please enter the number of pizzas sold for

Day 1: 5

Day 2: 9

Day 3: -3

Invalid value. Please enter valid value

Day 3: 3

Day 4: 12

Day 5: 4

Day 6: 16

Day 7: 22

Pizza Calculator

Sales Report

Day 1: 5

Day 2: 9

Day 3: 3

Day 4: 12

Day 5: 4

Day 6: 16

Day 7: 22

Total Pizzas Sold for the Week: 71

Average Pizza Sold for the week: 10.1

Total Revenue for the week: $603.50

Average Revenue per day: $86.21

Thank you for using Pizza Counter. Goodbye!

In: Computer Science

Write a solution to return the count of the number of nodes in a binary tree....

Write a solution to return the count of the number of nodes in a binary tree. Your method will be passed one parameter, a copy of a pointer to the root node of the tree (Node *) and will return an int that is the count of nodes. If the tree is empty, return 0 (this is the recursive base case).

In: Computer Science

Java Program Suppose a student was taking 5 different courses last semester. Write a program that...

Java Program

Suppose a student was taking 5 different courses last semester. Write a program that

(a) asks the student to input his/her name, student ID, marks for these 5 courses,

(b) calculate the average,

(c) determine the letter grade of each course.

(d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-.

(e) Output the following information in a nice format: student name, student ID, listing of marks, the average, letter grade for each course, and the number of courses in each letter grade category.

I dont know how to do d

here is my code:

import java.util.Scanner;

public class Question_2 {

   public String Grade(int mark) {

       String GradeLetter = "";

       if (mark >= 93 && mark <= 100)

           GradeLetter = "A+";

       if (mark >= 86 && mark < 93)

           GradeLetter = "A";

       if (mark >= 80 && mark < 86)

           GradeLetter = "A-";

       if (mark >= 77 && mark < 80)

           GradeLetter = "B+";

       if (mark >= 73 && mark < 77)

           GradeLetter = "B";

       if (mark >= 70 && mark < 73)

           GradeLetter = "B-";

       if (mark >= 67 && mark < 70)

           GradeLetter = "C+";

       if (mark >= 63 && mark < 67)

           GradeLetter = "C";

       if (mark >= 60 && mark < 63)

           GradeLetter = "C-";

       if (mark >= 57 && mark < 60)

           GradeLetter = "D+";

       if (mark >= 53 && mark < 57)

           GradeLetter = "D";

       if (mark >= 50 && mark < 53)

           GradeLetter = "D-";

       if (mark >= 35 && mark < 50)

           GradeLetter = "F";

       if (mark >= 0 && mark < 35)

           GradeLetter = "F-";

       return GradeLetter;

   }

   public static void main(String[] args) {

       Question_2 q2 = new Question_2();

       // declare variables

       String name;// student name

       int studentID;// student ID

       int mark1, mark2, mark3, mark4, mark5;// student marks in each 5 courses

       // asks the student to input his/her name

       System.out.println("Input your first name: ");

       Scanner input = new Scanner(System.in);

       name = input.nextLine();

       // asks the student to input student ID

       System.out.println("Input your StudentID (integer in 5 digits),ex:000000 :");

       studentID = input.nextInt();

       // asks the student to input marks of 5 different courses last semester

       System.out.println("Input your courses grade (0-100)integer number ");

       System.out.println("Your course1's grade: ");

       mark1 = input.nextInt();

       System.out.println("Your course2's grade: ");

       mark2 = input.nextInt();

       System.out.println("Your course3's grade: ");

       mark3 = input.nextInt();

       System.out.println("Your course4's grade: ");

       mark4 = input.nextInt();

       System.out.println("Your course5's grade: ");

       mark5 = input.nextInt();

       // Calculate the average of 5 different courses last semester

       double average = (mark1 + mark2 + mark3 + mark4 + mark5) / 5.0;

       /*

       * Output the following information in a nice format: student name,

       * student ID, listing of marks, the average, letter grade for each

       * course, and the number of courses in each letter grade category.

       */

       System.out.println("**********************************************");

       System.out.println("Student Name: " + name);

       System.out.println("Student ID : " + studentID);

       System.out.println(name + " grade in " + "Course1: " + mark1 + " " + q2.Grade(mark1));

       System.out.println(name + " grade in " + "Course2: " + mark2 + " " + q2.Grade(mark2));

       System.out.println(name + " grade in " + "Course3: " + mark3 + " " + q2.Grade(mark3));

       System.out.println(name + " grade in " + "Course4: " + mark4 + " " + q2.Grade(mark4));

       System.out.println(name + " grade in " + "Course5: " + mark5 + " " + q2.Grade(mark5));

       System.out.println(name + " avaerage grade is: " + average);

       System.out.println("**********************************************");

   }

}

In: Computer Science

What is the auxiliary space and space complexity for a dynamic programming algorithm with time complexity...

What is the auxiliary space and space complexity for a dynamic programming algorithm with time complexity of O(n^2)? Justify.

In: Computer Science