Questions
Write a PYTHON program that prompts the user to enter the account’s present value, yearly interest...

Write a PYTHON program that prompts the user to enter the account’s present value, yearly interest rate, and the number of years that the money will be left in the account. The program should pass these values to a function that returns the future value of the account, after the specified number of months. The program should display the accounts’ future value

In: Computer Science

In some cases high quality software products are delivered but are not used. As a result,...

In some cases high quality software products are delivered but are not used. As a
result, the information systems project is considered a failure. Under what
conditions can this occur? Develop arguments to support this claim.

In: Computer Science

You will write a Java Application program to perform the task of generating a calendar for...

You will write a Java Application program to perform the task of generating a calendar for the year 2020. You are required to modularize your code, i.e. break your code into different modules for different tasks in the calendar and use method calls to execute the different modules in your program. Your required to use arrays, ArrayList, methods, classes, inheritance, control structures like "if else", switch, compound expressions, etc. where applicable in your program. Your program should be interactive and able to display the calendar for 1 month, 3 months and all 12 months at the same time depending on the choice picked by the user.

Write a Java application program to generate the calendar for the year 2019 from January to December. The program will be menu driven, The menu items will include the following:

  • Year for the calendar of interest (2020)
  • How many Months do you want to display (1 month, 3 months, 12 months).
    • For 1 month
      • Display calendar for 1 month
      • The user will need to be able to type what month they want to display
    • For 3 months
      • Display calendar for 3 months
      • The user will need to be able to type in the starting month
    • For 12 months
      • All months will need to be visible on the user's screen
  • Exit
    • This will terminate the program

Your solution should follow the format below:

  1. Modularize your code by using different methods for different tasks in the program like checking for leap year, number of days in a month, first day of the week for a month, printing each month, etc.
  2. You may use Arrays 1-dimensional, 2-dimensional arrays and ArrayList where appropriate
  3. Write a method to test for leap year
  4. Write a method to find the first day of the week for January
  5. Use method calls and/or parameter passing
  6. Use other methods where appropriate
  7. Add comments to your code (e.g at the beginning of every method and any other part of the program for documentation purposes and to make your code readable)

BELOW IS THE CODE:

import java.util.Scanner;

   public class PrintCalendar {

     /** Main method */

     public static void main(String[] args) {
     Scanner scan = new Scanner (System.in);
      int month=4;
     //Prompt the user to enter year
     System.out.print("Year for the calendar of interest : ");
     int year = scan.nextInt();
   
      //Prompt the user to enter choice for month
     System.out.print("How many months u want to display :Enter 1. for One Month, 2. for Three Months, 3. for Twelve Months, 4. for Exit : ");
     int ch = scan.nextInt();

   
     // Prompt the user to enter month if choice is 1
     if (ch == 1){
     System.out.print("Enter month in number between 1 and 12: ");
     month = scan.nextInt();}
   
     // Prompt the user to enter month if choice is 1
     if (ch == 2){
     System.out.print("Enter starting month in number between 1 and 12: ");
     month = scan.nextInt();}
   

     // Print calendar for the month of the year
      if (month < 1 || month > 12 || year < 1980)
       System.out.println("Wrong input!");
       else
           {
             if (ch ==1)        
             printMonth(year, month);
             if (ch == 2)
             {
               printMonth(year, month);
               printMonth(year, month+1);
               printMonth(year, month+2);
             }
             if (ch == 3)
             {
               for(int k=1;k<=12;k++)
               printMonth(year, k);
             }
             if (ch == 4)
             {
               System.out.println("Exiting");
             }
           }
   }
    /** Print the calendar for a month in a year */

     static void printMonth(int year, int month) {

     //Print the headings of the calendar
      printMonthTitle(year, month);

     //Print the body of the calendar
      printMonthBody(year, month);
    }

    /** Print the month title, e.g., May, 1999 */

    static void printMonthTitle(int year, int month) {

    System.out.println("         " + getMonthName(month) + " " + year + " Calendar");
        System.out.println(" Sun Mon Tue Wed Thu Fri Sat ");

    }

    /** Get the English name for the month */
    static String getMonthName(int month) {
      String monthName = null;
      switch (month) {
        case 1: monthName = "January"; break;
        case 2: monthName = "February"; break;
        case 3: monthName = "March"; break;
        case 4: monthName = "April"; break;
        case 5: monthName = "May"; break;
        case 6: monthName = "June"; break;
        case 7: monthName = "July"; break;
        case 8: monthName = "August"; break;
        case 9: monthName = "September"; break;
        case 10: monthName = "October"; break;
        case 11: monthName = "November"; break;
        case 12: monthName = "December";
      }
      return monthName;
    }

    /** Print month body */
    static void printMonthBody(int year, int month) {

       // Get start day of the week for the first date in the month
      int startDay = getStartDay(year, month);

      // Get number of days in the month
      int numberOfDaysInMonth = getNumberOfDaysInMonth(year, month);

      // Pad space before the first day of the month
      int i = 0;
      for (i = 0; i < startDay; i++)
        System.out.print("    ");
      for (i = 1; i <= numberOfDaysInMonth; i++) {
        if (i < 10)
          System.out.print("   " + i);
        else
          System.out.print(" " + i);
        if ((i + startDay) % 7 == 0)
          System.out.println();
      }
      System.out.println();
    }

    /** Get the start day of the first day in a month */

   static int getStartDay(int year, int month) {

      //Get total number of days since 1/1/1800
      int startDay1800 = 3;
      int totalNumberOfDays = getTotalNumberOfDays(year, month);

      //Return the start day
      return (totalNumberOfDays + startDay1800) % 7;
    }

    /** Get the total number of days since January 1, 1800 */

    static int getTotalNumberOfDays(int year, int month) {
     int total = 0;

     //Get the total days from 1800 to year - 1
     for (int i = 1800; i < year; i++)
     if (isLeapYear(i))
        total = total + 366;
      else
        total = total + 365;

      //Add days from January to the month prior to the calendar month
      for (int i = 1; i < month; i++)
        total = total + getNumberOfDaysInMonth(year, i);

      return total;
    }

    /** Get the number of days in a month */

    static int getNumberOfDaysInMonth(int year, int month) {
      if (month == 1 || month == 3 || month == 5 || month == 7 ||
        month == 8 || month == 10 || month == 12)
        return 31;

      if (month == 4 || month == 6 || month == 9 || month == 11)
        return 30;

      if (month == 2) return isLeapYear(year) ? 29 : 28;

      return 0; // If month is incorrect
    }

    /** Determine if it is a leap year */
    static boolean isLeapYear(int year) {
      return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
    }
}

The solution for the problem is available AS ABOVE but AFTER RUNNING IT the menu doesn't look good and after running a selection, it's not going back to the menu for the USER To INPUT next choice until user chooses to exit. RUN IT AND SEE so Can you HELP modify it to output like below:

OR help with a fresh code. Thanks

include these on the menu as per question:

  • Year for the calendar of interest (2020)
  • How many Months do you want to display (1 month, 3 months, 12 months).

Welcome to the Calendar for the year 2019
-------------------------------------------------
1. Show Calendar for 1 month
2. Show Calendar for 3 months
3. Show Calendar for the year
4. Exit
Enter your selection (Only numbers are allowed):

In: Computer Science

b) UDP does not provide end to end flow control, but TCP does. Explain how this...

b) UDP does not provide end to end flow control, but TCP does. Explain how this is achieved using sequence numbers. Give an example where a packetized message sent using UDP is received incorrectly, but when using TCP it is received correctly under same circumstances without channel errors.                                                                     

In: Computer Science

Java Language Add a recursive method to the program shown in the previous section that allows...

Java Language

Add a recursive method to the program shown in the previous section that allows
insert a value at the end of the stack.

Code:

class Stack {

protected Node top;

Stack() {

top = null; }

boolean isEmpty() {

return( top == null); }

void push(int v) {

Node tempPointer;

tempPointer = new Node(v);

tempPointer.nextNode = top;

top = tempPointer; }

int pop() {

int tempValue;

tempValue = top.value;

top = top.nextNode;

return tempValue; }

void printStack() {

Node aPointer = top;

String tempString = "";

while (aPointer != null) {

tempString = tempString + aPointer.value + "\n";

aPointer = aPointer.nextNode; }

System.out.println(tempString); }

boolean hasValue(int v) {

if (top.value == v) {

return true; }

else {

return hasValueSubList(top,v);

}

}

boolean hasValueSubList(Node ptr, int v) {

if (ptr.nextNode == null) {

return false; }

else if (ptr.nextNode.value == v) {

return true; }

else {

return hasValueSubList(ptr.nextNode,v);

}

}

}

class Node {

int value;

Node nextNode;

Node(int v, Node n) {

value = v;

nextNode = n;

}

Node (int v) {

this(v,null);

}

}

public class StackWithLinkedList2{

public static void main(String[] args){

int popValue;

Stack myStack = new Stack();

myStack.push(5);

myStack.push(7);

myStack.push(9);

System.out.println(myStack.hasValue(11));

}

}

System.out.println(myStack.hasValue(11)); } }

In: Computer Science

Java Language Add a recursive method to the program shown in the previous section that allows...

Java Language

Add a recursive method to the program shown in the previous section that allows remove the last node from the stack.

Code:

class Stack {

protected Node top;

Stack() {

top = null; }

boolean isEmpty() {

return( top == null); }

void push(int v) {

Node tempPointer;

tempPointer = new Node(v);

tempPointer.nextNode = top;

top = tempPointer; }

int pop() {

int tempValue;

tempValue = top.value;

top = top.nextNode;

return tempValue; }

void printStack() {

Node aPointer = top;

String tempString = "";

while (aPointer != null) {

tempString = tempString + aPointer.value + "\n";

aPointer = aPointer.nextNode; }

System.out.println(tempString); }

boolean hasValue(int v) {

if (top.value == v) {

return true; }

else {

return hasValueSubList(top,v);

}

}

boolean hasValueSubList(Node ptr, int v) {

if (ptr.nextNode == null) {

return false; }

else if (ptr.nextNode.value == v) {

return true; }

else {

return hasValueSubList(ptr.nextNode,v);

}

}

}

class Node {

int value;

Node nextNode;

Node(int v, Node n) {

value = v;

nextNode = n;

}

Node (int v) {

this(v,null);

}

}

public class StackWithLinkedList2{

public static void main(String[] args){

int popValue;

Stack myStack = new Stack();

myStack.push(5);

myStack.push(7);

myStack.push(9);

System.out.println(myStack.hasValue(11));

}

}

System.out.println(myStack.hasValue(11)); } }

System.out.println(myStack.hasValue(11)); } } System.out.println(myStack.hasValue(11)); } }

In: Computer Science

This homework will allow us to check for understanding and comfort with things you should know:...

This homework will allow us to check for understanding and comfort with things you should know: Input/output, variables, expressions, conditionals, loops, arrays, functions, and classes.

  • Language: Java
  • Required parts:
  1. Write a program that asks the user for a number, then asks for a second number, and finally prints if the first is smaller than the second, greater than the second, or equal to the second. (10 points)
  2. Write a program that asks the user to enter a number, and then using a loop, outputs all integers, that are smaller than the entered number. (15 points)
  3. Write a program that creates an array of 10 random numbers. After the array is created, a function receives the array, and returns the index of the highest element. (30 points)
  4. Implement a class called Vehicle, with the following methods (45 points):
    • SetNumberOfPassengers(int)
      • Stores the argument value in an attribute
    • GetNumberOfPassengers()
      • Returns the attribute
    • SetNumberOfWheels(int)
      • Stores the argument value in an attribute
    • GetNumberOfWheels()
      • Returns the attribute
  • Bonus parts:
  1. Write a program that asks the user for a number, and outputs all prime numbers smaller than the number entered (15 points)
  2. Implement a class called Bicycle, which (5 points):
    • Inherits from the class Vehicle you implemented in exercise 4 of the required parts above.
    • Sets the number of passengers to 1.
    • Sets the number of wheels to 1.

In: Computer Science

Java Language Add a recursive method to the program shown in the previous section that states...

Java Language

Add a recursive method to the program shown in the previous section that states
how many nodes does the stack have.

Code:

class Stack {

protected Node top;

Stack() {

top = null; }

boolean isEmpty() {

return( top == null); }

void push(int v) {

Node tempPointer;

tempPointer = new Node(v);

tempPointer.nextNode = top;

top = tempPointer; }

int pop() {

int tempValue;

tempValue = top.value;

top = top.nextNode;

return tempValue; }

void printStack() {

Node aPointer = top;

String tempString = "";

while (aPointer != null) {

tempString = tempString + aPointer.value + "\n";

aPointer = aPointer.nextNode; }

System.out.println(tempString); }

boolean hasValue(int v) {

if (top.value == v) {

return true; }

else {

return hasValueSubList(top,v);

}

}

boolean hasValueSubList(Node ptr, int v) {

if (ptr.nextNode == null) {

return false; }

else if (ptr.nextNode.value == v) {

return true; }

else {

return hasValueSubList(ptr.nextNode,v);

}

}

}

class Node {

int value;

Node nextNode;

Node(int v, Node n) {

value = v;

nextNode = n;

}

Node (int v) {

this(v,null);

}

}

public class StackWithLinkedList2{

public static void main(String[] args){

int popValue;

Stack myStack = new Stack();

myStack.push(5);

myStack.push(7);

myStack.push(9);

System.out.println(myStack.hasValue(11));

}

}

System.out.println(myStack.hasValue(11));

}

}

In: Computer Science

# Write three functions to return the pieces of a string containing # a city, state,...

# Write three functions to return the pieces of a string containing

# a city, state, and zip code.

# This function needs a better comment

def get_zip(city_state_zip):   

return city_state_zip[-1]

# This function needs a better comment

def get_city(city_state_zip):

return city_state_zip[0:2]

# This function needs a better comment

def get_state(city_state_zip):   

return 'Confusion'

def main():   

place1 = 'Rolla, MO 65402'   

place2 = 'Cape Girardeau,     MO 63780'   

place3 = 'St. Louis,MO63111'   

place4 = 'International Falls,MN               56650     '  

# Print the individual components   

print ('City:', get_city(place1))   

print ('State:', get_state(place1))   

print ('Zip:', get_zip(place1))    

# Repeat printing for the rest of the placesmain()

Directions

Your assignment is to write 3 functions, each of which takes a single string parameter representing [city, state, and zip code] and returns the indicated piece of the string. The main program should call each function, and print the returned values, one per line. However, the data that is passed to the functions was input on a keyboard that had a temperamental space bar. Sometimes it doesn't work and other times it generates multiple spaces, so the data may look like

'Rolla,MO   65402'

or

'Springfield, MO65897'

The one thing that is consistent is that there is a comma after the city name, the state is always two upper case characters, and the zip code is 5 adjacent characters 0-9.

For the first case listed, your program should output:

City: Rolla
State: MO
Zip: 65402

To make things interesting, add two more variables with cities of your choice. Choose the spacing to help test your program.

In: Computer Science

Write a program using c, c++, or java that have four dynamic memory partitions of size...

Write a program using c, c++, or java that have four dynamic memory partitions of size 100 KB, 500 KB, 200 KB, and 450 KB. The program should accept from user the number of processes and their sizes. Then output the assignment of processes using the next fit algorithm (specifying which process, if any, is block).

In: Computer Science

convert -47.199 to IEEE-754 single precision and double precision both. Need a lot of explanation. (Atleast...

convert -47.199 to IEEE-754 single precision and double precision both.
Need a lot of explanation. (Atleast 1000 words)

In: Computer Science

I'm using livesql for my database class to try and do these A medical clinic has...

I'm using livesql for my database class to try and do these

A medical clinic has doctors, along with patients assigned to one of the doctors.

Create 2 tables that include fields below with primary key chosen below. Use appropriate data types and simplified field names, eg: -

Doctor’s Table:
DKey ID          
Last name
First name
Home phone
Medical specialty
Monthly Salary

Patient’s Table:
PKey ID          
Last name
First name
Address (Use Address as column name)
Home Phone  
Age (in years)      
DoctorID Assigned
Medical History
Add 3 doctors and about 8 patients. Values will be provided in a text file to save time.

Create 3 select statements
List all doctors,
List all patients,
Using where clause, show which doctors have which patients. (Make sure your result indicates who is Doctor and who is Patient.

List the ID num, first and last name of doctors who has a salary that is greater than 16000.

Create the following aggregate select statements.
The monthly sum of all doctors’ salaries
The average age of the patients


Write a SQL statement to show the total number of rows in Patient table. Sort by last name.


Select the lastname, firstname, assigned doctor of patients where the patient’s medical history is Diabetic.


Write a SQL statement to change one of the patient’s name “Kasuma” who recently got married and which to use her married name “Chutaw.” Patient ID number is 103. (10pts)


Write a SQL statement to increase all Doctors salary by 20% and rename column as Salary Increase


List all the patients with high blood pressure and are older than 49 years old.

text file with values are:

Doctor Table


('AM01','Abrams','Miles','617-555-6032','MD', 20000);

('BR01','Boyers','Rita','603-555-2134','MD', 15000);

('DH01','Devon','Harley','781-555-7767','MD', 17000);



Patient Table


('101','Northfold','Liam','9 Old Mill Rd. Londonderry NH','603-555-7563', '45', 'BR01', 'Breat Cancer');

('102','Ocean','Arnold','2332 South St. Apt 3 Springfield MA','413-555-3212', '55','AM01', 'Diabetic');

('103','Kasuma','Sujata','132 Main St. 1 East Hartford CT','860-555-0703','64', 'DH01', 'High Blood Pressure');

('104','Goff','Ryan','164A South Bend Rd.Lowell MA','781-555-8423','50','DH01','Left Renal abnormality');

('105','McLean','Kyle','345 Lower Ave. Wolcott NY','585-555-5321', '60','BR01', 'Diabetic');

('106','Morontoia','Joseph','156 Scholar St. Johnston RI','401-555-4848', '52','DH01','High Blood Pressure');

('107','Marchand','Quinn','76 Cross Rd. Bath NH','603-555-0456', '40','AM01','Diabetic');

('108','Rulf','Uschi','32 Sheep Stop St. Edinboro PA','814-555-5521', '75','BR01', 'Low Blood Count');

i'm stuck at creating a second table "create table patient" and livesql keeps telling me im missing a parenthesis >_<

In: Computer Science

Below is my source code for file merging. when i run the code my merged file...

Below is my source code for file merging. when i run the code my merged file is blank and it never shows merging complete prompt. i dont see any errors or why my code would be causing this. i saved both files with male names and female names in the same location my source code is in as a rtf

#include
#include
#include
using namespace std;

int main()
{
ifstream inFile1;
ifstream inFile2;
ofstream outFile1;
int mClientNumber, fClientNumber;
string mClientName;
   string fClientName;
bool atLeastOneFileNotAtEnd = true;
bool inFile1Written = false;
bool inFile2Written = false;
  
cout << "File merge processing starting." << endl;
  
inFile1.open("MaleClients.rtf");
inFile2.open("FemaleClients.rtf");
outFile1.open("MergedClients.rtf");
  
inFile1 >> mClientNumber;
   inFile1 >> mClientName;
inFile2 >> fClientNumber;
   inFile2 >> fClientName;
  
   while (atLeastOneFileNotAtEnd == true)
{
   if(inFile1.eof())
{
   if(inFile2Written == false)
{
   outFile1 << fClientNumber << " " << fClientName << endl;
inFile2Written = true;
}
   }
else if(inFile2.eof())
{
if(inFile1Written == false)
{
outFile1 << mClientNumber << " " << mClientName << endl;
inFile1Written = true;
}
}
else if (mClientNumber < fClientNumber)
{
outFile1 << mClientNumber << " " << mClientName << endl;
inFile1Written = true;
}
else
{
outFile1 << fClientNumber << " " << fClientName << endl;
inFile2Written = true;
}
  
if ((!inFile1.eof()) && (inFile1Written == true))
{
   inFile1 >> mClientNumber >> mClientName;
inFile1Written = false;
}
  
if ((!inFile2.eof()) && (inFile2Written == true))
{
inFile2 >> fClientNumber >> fClientName;
inFile2Written = false;
}
  
if ((inFile1.eof()) && (inFile2.eof()))
{
   atLeastOneFileNotAtEnd = false;
   }
  
  
}
  
   inFile1.close();
inFile2.close();
outFile1.close();
  
cout << "Merging Complete." << endl;
  
   return 0;
}

In: Computer Science

Please write in C using linux or unix. Write a program that will simulate non -...

Please write in C using linux or unix.

Write a program that will simulate non - preemptive process scheduling algorithm:

First Come – First Serve

Your program should input the information necessary for the calculation of average turnaround time including:

  • Time required for a job execution;
  • Arrival time;

The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time.

Step 1: generate the input data (totally 10 jobs) and save it in the array of structure composing the arrival time, service time, termination time, turnaround time. The service time follows the uniform distribution in the range of [5, 25], and the arrival time is generated by uniform distribution in the range of [0,10] accumulated based on the previous arrival time.

Step 2: program FCFS algorithm.

Note: be careful about the situation that one job is finished while the next job is not arrived yet, so you have the idle time between them.

Step 3: output

print out one line for each job with arrival time, start time, service, termination time, turnaround time, finally average turnaround time in the last line.

In: Computer Science

identify a company that uses the internet of marketing, sales and promotion

identify a company that uses the internet of marketing, sales and promotion

In: Computer Science