Questions
I am trying to write a simple game in Java named GuessNumber.java to run on the...

I am trying to write a simple game in Java named GuessNumber.java to run on the command line. This program asks user to pick a number and the computer guesses the number repetitively until the guess is correct and will allow the user to set the lower and upper bound as command line parameters from where the picks the number. If no command line parameters are specified then the program uses a default of 1 to 99.

In: Computer Science

2. Dice rolling (15 pts) Problem Description: Write a program that rolls a pair of six-sided...

2. Dice rolling (15 pts) Problem Description: Write a program that rolls a pair of six-sided dice, then displays their values sum.

• You can use the random method of the Math class to generate a random number for a die like this: (int) (Math.random() * 6) + 1;

• The application should display special messages for two ones (snake eyes) and two sixes (box cars).

• The application should use static methods (at least two) to organize its code.

• The application should continue only if the user enters “y” or “Y” at the “Roll again?” prompt.

Here is a sample run:

Dice Roller

Roll the dice? (y/n): y

Die 1: 3

Die 2: 1

Total: 4

Roll again? (y/n): y

Die 1: 1

Die 2: 1

Total: 2 Snake eyes!

Roll again? (y/n): y

Die 1: 6

Die 2: 6

Total: 12 Boxcars!

Roll again? (y/n): n

Good bye!

This is for java please check for debugging ! also please leave comments so I could follow steps and better understand

In: Computer Science

(Palindrome integer) Write the methods with the following headers // Return the reversal of an integer,...

(Palindrome integer) Write the methods with the following headers
// Return the reversal of an integer, i.e., reverse(456) returns 654
public static int reverse(int number)
// Return true if number is a palindrome
public static boolean isPalindrome(int number)

Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. Write a test program that prompts the user to enter an integer and reports whether the integer is a palindrome.

Here is a sample run: (red indicates a user input)

Enter a positive integer: 12321

12321 is a palindrome.

Continue? (y/n) y

Enter a positive integer: 12345

12345 is not a palindrome.

Continue? (y/n) n

Good bye!

This is for java if you could make it so it is debugged so theres no inputs that could make it crash! :(

Please leave comments

In: Computer Science

using python #You've been sent a list of names. Unfortunately, the names #come in two different...

using python

#You've been sent a list of names. Unfortunately, the names
#come in two different formats:
#
#First Middle Last
#Last, First Middle
#
#You want the entire list to be the same. For this problem,
#we'll say you want the entire list to be Last, First Middle.
#
#Write a function called name_refixer. name_refixer should have two
#parameters: an output filename (the first parameter) and the
#input filename (the second parameter). You may assume that every
#line will match one of the two formats above: either First Middle
#Last or Last, First Middle.
#
#name_refixer should write to the output file the names all
#structured as Last, First Middle. If the name was already structured
#as Last, First Middle, it should remain unchanged. If it was
#structured as First Middle Last, then Last should be moved
#to the front and a comma should be added after it.
#
#The names should appear in the same order as the original file.
#
#For example, if the input file contained the following lines:
#David Andrew Joyner
#Hart, Melissa Joan
#Cyrus, Billy Ray
#
#...then the output file should contain these lines:
#Joyner, David Andrew
#Hart, Melissa Joan
#Cyrus, Billy Ray


#Add your code here!

#The code below will test your function. You can find the two
#files it references in the drop-down in the top left. If your
#code works, output_file.txt should have the text:
#Joyner, David Andrew
#Hart, Melissa Joan
#Cyrus, Billy Ray
name_refixer("output_file.txt", "input_file.txt")
print("Done running! Check output_file.txt for the result.")

#If you accidentally erase input_file.txt, here's its original
#text to copy back in (remove the pound signs):
#David Andrew Joyner
#Hart, Melissa Joan
#Cyrus, Billy Ray

In: Computer Science

Problem: Your have been asked by a cell phone service provider to write a program that...

Problem: Your have been asked by a cell phone service provider to write a program that will calculate the amount of a customer’s monthly bill. Write a C++ program that will calculate the amount of the bill given the number of lines and the amount of minutes used during the month. Unlimited texting is also offered. '

The cellular service provider offers the following options and pricing: One line for $6/month base cost. Two lines for $12/month base cost.

The voice rates are as follows:

• No minutes: $0

• 1-400 minutes: $9 total

• 401-800 minutes: $16 total

• over 800 minutes: $16 + 1.9 cents/minute over 800 Unlimited texting is $5 extra.

Input: The program should ask the user if they have (A) one line or (B) two lines. Then the program should ask the user to input the number of minutes used in the month (no fractional amounts) Then the program should ask if the user has unlimited text messages (Y or N).

For the first two input values, use an if statement to perform input validation. The user should select only A, or B for the number of lines, and the minutes should be between 0 and 44640 (inclusive).

If either input is invalid, the program should ask the user to reenter the value (but only once, no looping).

Do not validate the response to the last question. 1 Processing: Compute the amount of the monthly bill according to the descriptions above.

If the user answered ‘y’ or ‘Y’ to the last question, your program should add $5 to the bill.

Output: Display the amount of the monthly bill with a dollar sign and formatted to 2 decimal places.

Here are 5 different sample executions of the program: How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 100 Unlimited text messages? (Y/N): N The amount due for the month is $15.00

How many lines: A. One line B. Two lines B Enter the total number of minutes used during the month: 750 Unlimited text messages? (Y/N): Y The amount due for the month is $33.00

How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 850 Unlimited text messages? (Y/N): Y The amount due for the month is $27.95

How many lines: A. One line B. Two lines A Enter the total number of minutes used during the month: 803 Unlimited text messages? (Y/N): y The amount due for the month is $27.06 2 How many lines: A. One line B. Two lines C Please enter A, or B: A Enter the total number of minutes used during the month: 1234567 Please enter a number between 0 and 44640 for the minutes: 500 Unlimited text messages? (Y/N): n The amount due for the month is $22.00

In: Computer Science

WEEK 6 ASSIGNMENT Using your RFP or the Desktop Lab Project from Week Five - write...

WEEK 6 ASSIGNMENT

  • Using your RFP or the Desktop Lab Project from Week Five - write a detailed scope statement, and then
  • Answer the following questions:
    1. What problem or opportunity does the project address?
    2. What quantifiable results are to be achieved?
    3. What needs to be done?
    4. How will success be measured?
    5. How will we know when we are finished?

In: Computer Science

Your data science experiment now requires four additional data tasks. The first task is to use...

Your data science experiment now requires four additional data tasks. The first task is to use the list append method to add to the list variable named btcdec1 the BTC price of 14560. The second task is to create a new list with a variable named btcdec2 and append the btc prices of 15630, 12475, and 14972. The third task required you to use the list extend method to add the contents of the list in variable name btcdec2 into the variable name btcdec1. The fourth and final task requires you to use the list sort method in the list named btcdec1 to sort the items in the newly extended list, then use the print statement to output the content of list btcdec1 into the Python console.

In: Computer Science

NEED ASAP PLEASE IF THIS CANNOT BE ANSWERED WITHIN 1 HOUR TO 1.5 HOURS MAX PLEASE...

NEED ASAP PLEASE IF THIS CANNOT BE ANSWERED WITHIN 1 HOUR TO 1.5 HOURS MAX PLEASE DO NOT DO

I DON'T NEED PROBLEMS 1-4 PLEASE ANSWER 5-7 ONLY. ONLY LISTED 1-4 AS A REFERENCE.

This should be in

Type of application :Console application

Language used :C#

Program.cs :

Problem 1:

(15 pts)

Write a C# console program that continually asks the user "Do you want

to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters

either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and

then get keyboard input of the name. After entering the name, display the name to the screen.

Problem 2:

(20 pts) Create a Patient class which has private fields for patientid, lastname,

firstname, age, and email. Create public properties for each of these private fields with get and

set methods. The entire lastname must be stored in uppercase. Create a main class which

instantiates a patient object and sets values for each data item within the class. Display the

data in the object to the console window.

Problem 3:

(15 pts) Modify the Patient class with two overloaded constructors: A new default

constructor which initializes the data items for a patient object using code within the

constructor (use any data). A second constructor with parameters to pass all the data items

into the object at the time of instantiation. Create a test main class which instantiates two

objects. Instantiate the first object using the default constructor and the second object using

the constructor with the parameters.

Problem 4:

(10 pts) Add a static display method in the main class in the patient application

that has a parameter to pass a patient object and display its content.

Problem 5:

(10 pts) Modify the patient class with two overloaded methods to display a bill for a

standard visit based on age. In the first method do not use any parameters to pass in data. If

the patient is over 65, then a standard visit is $75. If the patient is under 65, then the standard

doctors office visit is $125. Build a second method where you pass in a discount rate. If the

patient is over 65, then apply the discount rate to a standard rate of $125. Create a main

method that calls both of these methods and displays the results.

Problem 6:

(20 pts) Create two subclasses called outpatient and inpatient which inherit from

the patient base class. The outpatient class has an additional data field called doctorOfficeID

and the inpatient class has an additional data item called hospitalID. Write a main method that

creates inpatient and outpatient objects. Sets data for these objects and display the data.

Problem 7:

( 10 pts) Modify the base class of Problem 6 to be an abstract class with an abstract

display method called displayPatient that does not implement any code. Create specific

implementations for this method in both the outpatient and inpatient subclasses.

In: Computer Science

You are developing an application that prints out invoice information of customers and cars from dealers....

You are developing an application that prints out invoice information of customers and cars from dealers. The invoice contains: dealer name, customer name, customer’s phone number, car maker, building year, and total price. Please follow below instructions to write a program.

Part 1 create data types

1. Create an enumerated data type that holds 7 car colors, which are: red, black, white, blue, yellow, gray, and silver;

2. Create a structure for car that holds 4 members: car maker, building year, car color, and total price;

3. Create another structure for customer that holds 2 members: customer name, and customer phone number;

4. Create a third structure for invoice that holds 3 members: dealer name, customer information and car information. The car information is a pointer.

Part 2 define functions

1. Define a function that returns price rate base on the car color. If the car’s color is red, black or white, then the rate is 1. If the color is blue or yellow, then the rate is 1.5. If the color is gray or silver, then the rate is 2;

2. Define a function that copy each member in an invoice variable (e.g., var1) and assign these members to another invoice variable (e.g., var2). Then return this copied invoice variable (var2);

3. Define a function that display invoice information, which includes:

• Dealer name

• Customer name

• Customer phone number

• Car maker

• Car building year

• Car total price

Part 3 manipulate data

A car inventory of cars contains information of three cars: 2018 white Honda, 2019 blue BMW, 2018 silver Tesla. The initial price of each car starts at the price of $30,000. The color base price is $300, and it is varied by multiplying the price rate.

1. Define three pointers that hold char array values for car maker: Honda, BMW, Tesla;

2. Define a C++ string array that holds values of model year;

3. Define a pointer of the car’s type (car pointer) and dynamic allocate an array of size 3;

4. Define a pointer (price pointer) that dynamic allocate an array of size 3. The values pointed by the price pointer and its offsets are total price for each car;

5. Base on color information and price rate, calculate total prices and store them into price pointer and its offsets: total price = initial price + (color base price * price rate);

6. According to above information, store makers, model years, car color, and total price to the car array that pointed by car pointer.

A customer named Tom Smith comes to Carfax to buy the 2019 blue BMW. His phone number I (408)123-4567.

1. Create a variable of invoice type (invoice variable) and store dealer, customer, and car information;

2. Call the display function to print out invoice information.

Later, Tom Smith goes to KBB and buy the 2018 silver Tesla.

1. Create another variable of invoice type (copied invoice variable) and copy contents from invoice variable;

2. Modify contents in copied invoice variable to match the second transaction information;

3. Call the display function to print out this invoice information.

In: Computer Science

C++ program which partitions n positive integers into two disjoint sets with the same sum. Consider...

C++ program which partitions n positive integers into two disjoint sets with the same sum. Consider all possible subsets of the input numbers.

All in one C++ file.

This is the sample Input 1

6
3 5 20 7 1 14

Output 1

Equal Set: 1 3 7 14

This is the sample Input 2

5
10 8 6 4 2

Output 2

Equal Set: 0

In: Computer Science

Case Study 1: Recent attacks How could the attack been prevented if the five fundamental security...

Case Study 1: Recent attacks

  1. How could the attack been prevented if the five fundamental security principles—layering, limiting, diversity, obscurity, and simplicity—had been applied?

  1. Create a table that lists each of these security principles and how they could have been used to mitigate the attack.

Case Study 2: Crypto-malware Attacks

Use the Internet to research some of the recent different crypto-malware ransomware attacks.

  1. Define Crypto-malware Attacks and list some of them.
  2. What do they do?
  3. Why are they so successful?
  4. How are they being spread?
  5. What can users do to protect themselves?

In: Computer Science

Review the General Programming Assignment instructions. In this chapter, the class dateType was designed to implement...

  1. Review the General Programming Assignment instructions.
  2. In this chapter, the class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables. Rewrite the definitions of the function setDate and the constructor so that the values for the month, day, and year are checked before storing the date into the member variables.
  3. Add a member function, isLeapYear, to check whether a year is a leap year. Moreover, write a test program to test your class.
  4. The class dateType was designed and implemented to keep track of a date, but it has very limited operations. Redefine the class dateType so that it can perform the following operations on a date, in addition to the operations already defined:
    1. Set the month.
    2. Set the day.
    3. Set the year.
    4. Return the month.
    5. Return the day.
    6. Return the year.
    7. Test whether the year is a leap year.
    8. Return the number of days in the month. For example, if the date is 3-12-2017, the number of days to be returned is 31 because there are 31 days in March.
    9. Return the number of days passed in the year. For example, if the date is 3-18-2017, the number of days passed in the year is 77. Note that the number of days returned also includes the current day.
    10. Return the number of days remaining in the year. For example, if the date is 3-18-2017, the number of days remaining in the year is 288.
    11. Calculate the new date by adding a fixed number of days to the date. For example, if the date is 3-18-2017 and the days to be added are 25, the new date is 4-12-2017.
  5. Write the definitions of the functions to implement the operations defined for the latest version of the class dateType.
  6. The class dateType prints the date in numerical form. Some applications might require the date to be printed in another form, such as March 24, 2017.
    1. Derive the class extDateType so that the date can be printed in either form.
    2. Add a member variable to the class extDateType so that the month can also be stored in string form.
    3. Add a member function to output the month in the string format, followed by the year—for example, in the form March 2017.
    4. Write the definitions of the functions to implement the operations for the class extDateType.
    5. Using the classes extDateType and dayType (See Chap 10 Prog Ex 5), design the class calendarType so that, given the month and the year, we can print the calendar for that month. To print a monthly calendar, you must know the first day of the month and the number of days in that month. Thus, you must store the first day of the month, which is the form dayType, and the month and the year of the calendar. Clearly, the month and the year can be stored in an object of the form extDateType by setting the day component of the date to 1 and the month and year as specified by the user. Thus, the class calendarType has two member variables: an object of the type dayType and an object of the type extDateType.
    6. Design the class calendarType so that the program can print a calendar for any month starting January 1, 1500. Note that the day of January 1 of the year 1500 is a Monday. To calculate the first day of a month, you can add the appropriate days to Monday of January 1, 1500.
  7. For the class calendarType, include the following operations:
    1. Determine the first day of the month for which the calendar will be printed. Call this operation firstDayOfMonth.
    2. Set the month.
    3. Set the year.
    4. Return the month.
    5. Return the year.
    6. Print the calendar for the particular month.
    7. Add the appropriate constructors to initialize the member variables.
  8. Write the definitions of the member functions of the class to implement the operations of the class calendarType.
  9. Write a test program to print the calendar for either a particular month or a particular year.

    For example, the calendar for September 2017 is:

    September 2017

    Sun      Mon     Tue      Wed    Thu      Fri        Sat
    1 2
    3          4          5          6          7          8         9
    10        11        12        13        14        15        16       
    17        18        19        20        21        22        23       
    24        25        26        27        28        29        30

In: Computer Science

Write an evenTest(n) function that returns True if it is given an even integer and False...

Write an evenTest(n) function that returns True if it is given an even integer and False if it is given an odd number. The rest of your code (outside of the function) should get an integer number from the user, call evenTest(n) to test if the number is even, and then tell the user if the number was even or odd. Name the program even_or_odd.py.
Part 2. Salary.py (5 pts) You are offered two options to receive salary: • Option 1: Constant Salary: Receive $100 each day for 10 days • Option 2: Doubling Salary: $1 the first day, $2 the second day, $4 the third day, $8 the fourth day, doubling the amount each day, for 10 days. Define a function constant_salary() that computes and returns the total income for Option 1. Define a function doubling_salary() that computes and returns the total income for Option 2. The rest of your code (outside of the functions) should call both functions, compare the totals they return, and determine which salary option pays more. This program does not ask the user for any input. Name the program salary.py.

In: Computer Science

Design and develop a class named Person in Python that contains two data attributes that stores...

Design and develop a class named Person in Python that contains two data attributes that stores the first name and last name of a person and appropriate accessor and mutator methods. Implement a method named __repr__ that outputs the details of a person.


Then Design and develop a class named Student that is derived from Person, the __init__ for which should receive first name and last name from the class Person and also assigns values to student id, course, and teacher name. This class needs to redefine the __repr__ method to person details as well as details of a student. Include appropriate __init__.

Design and develop a class named Teacher that is derived from Person. This class should contain data attributes for the course name and salary. Include appropriate __init__. Finally, redefine the __repr__ method to include all teacher information in the printout.


Implement an application/driver that creates at least two student objects and two teacher objects with different values and calls __repr__ for each.

In: Computer Science

JAVA LANGUAGE Create a new project named BankAccount in Eclipse. Then, implement the following requirements. You...

JAVA LANGUAGE

Create a new project named BankAccount in Eclipse. Then, implement the following requirements. You need to create two classes, one for BankAccount (BankAccount.java) and the other for the tester (BankAccountTest.java).
Make sure your program compile without errors before submitting. Submit .java files to eCampus by the end of next Thursday, 10/15/2020.

Part 1: Create the BankAccount class (template is attached after the project description) in the project. You must add the following to the BankAccount class:

An instance variable for bank account number: accountNum
The long getAccountNum() method to get the account number
The void setAccountNum(long acctnum) method to set the account number
An instance variable for bank account owner’s name: name
The String getAccountName() method to get the account owner’s name
The void setAccountName(String acctname) method to set the account owner’s name
Another instance variable for account overdrawn status: overdrawn
The boolean isOverdrawn() method to get the account overdrawn status
The void setOverdrawn(boolean status) method to set the account overdrawn status
A constructor with four parameters: name, account number, the initial balance, and the overdrawn status to set the initial values for the instance variables when an object is created
Modify the withdraw() and deposit() methods
An account will be overdrawn if a withdrawal results in a negative balance.
An account that was overdrawn will not be overdrawn anymore if a deposit results in a positive balance or 0.
The deposit and withdraw methods must verify the amount to deposit (or to withdraw). If the amount is negative, the methods must printout "Negative amount!" and the balance of the account will not be changed.
Add a method called transfer(double amount, BankAccount otherAccount)
The transfer method is to transfer some money from the account to another account specified by otherAccount.
Add a method addInterest ( ) to add interest to the account and change the balance
use a constant to represent the interest rate 3.5%
Add the toString() method to represent an account in the following format:
“The Account Number xxx is owned by xxx with a Balance xxx. It is (not) overdrawn.”
Here xxx needs to replace by the values of the account. If it is overdrawn, show   
overdrawn. Otherwise, show not overdrawn.

Part 2: Create a BankAccountTest class with only the main method in the BankAccount project to test the BankAccount class. You must add the following to the BankAccountTest class:

Create a BankAccount object named harrysChecking with the initial values: name as "Harry", accoutNum as 12345, balance as 0.00, and overdrawn as false
Print out the object harrysChecking by calling toString() method
Call the deposit method to deposit $200 to harrysChecking and then print out the current balance and overdrawn status of harrysChecking
Call the withdraw method to withdraw $500 from harrysChecking and then print out the current balance and overdrawn status of harrysChecking
Again call the deposit method to deposit $400 to harrysChecking and then print out the current balance and overdrawn status of harrysChecking
Create a BankAccount object named harrysSaving with the initial values: name as "Harry", accoutNum as 86754, balance as 500.00, and overdrawn as false
Print out the object harrysSaving by calling toString() method
Call the transfer method to transfer $50 from harrysChecking to harrysSaving
Print out the current balances of harrysChecking and harrysSaving, respectively
Call the addInterest method to add interest to harrysSaving and Print out information for harrysSaving by calling toString() method

/**
A bank account has a balance that can be changed by deposits,
withdrawals, transfers, and interests.
*/
public class BankAccount {

   private double balance;
  
  
   /**
   Constructs a bank account with a zero balance
   */
   public BankAccount() {
       balance=0;
   }
  
   /**
   Constructs a bank account with a given balance
   @param initialBalance the initial balance
   */
   public BankAccount(double initialBalance) {
       balance=initialBalance;
   }
  
   /**
   Deposits money into the bank account.
   @param amount the amount to deposit
   */
   public void deposit (double amount) {
       balance=balance+amount;
   }
  
   /**
   Withdraws money from the bank account.
   @param amount the amount to withdraw.
   */
   public void withdraw (double amount) {
       balance=balance-amount;
   }
  
   /**
   Gets the current balance of the bank account.
   @return the current balance
   */
   public double getBalance() {
       return balance;
   }
}

public class BankAccountTest {

   public static void main(String[] args) {

   }
}

In: Computer Science