Complete my program (Lab1.c program) such that it prompts the user for an input value in

form of a long int and prints all prime numbers that end with digits 137

between 2 and the user-provided input. Do not modify any lines of code already

written in the program. Also, do not add any other functions, #include

directives, or macros to this program.(Lab1.c program)

#include

#include

#include/* returns true if n is prime, otherwise false. */

bool isPrime(long int n)

{

}/* returns true if n ends with 137, otherwise false. */

bool endsWith137(long int n)

{

}int main(int argc, char* argv[])

{return 0;

}

# Download Category: Programming

## CarClass

You’ll design a class named Car that has the following fields:

yearModel—An Integer that holds the car’s year model

make—A String that holds the make of the car

speed—An Integer that holds the car’s current speed

The class should have the following constructor and other methods:

The constructor should accept the car’s year, model, and make

as arguments. These values should be assigned to the object’s

yearModel and make fields. The constructor should also assign

0 to the speed field.

Design appropriate accessor methods to get the values stored in

an object’s yearModel, make, and speed fields.

The accelerate method should add 5 to the speed field each time it’s called.

The brake method should subtract 5 from the speed field each time it’s called.

## Loan Agency #

Loan Agency wants to get some account information from banks . They need data like account number , account holder name , bank name and balance . They will need this information in specified file format .Write a program to write the content to the file.In ‘Main’,Get the account number , account holder name , bank name and balance from the user.Write these content to the file, output.csv in comma seperated.Sample Input:Enter Account No : 234567Enter Account Holder Name : PeterEnter Bank Name : SBIEnter Bank Balance:40000Sample Output:Bank Information written to file successfully.The file “output.csv” should contain the bank information234567,Peter,SBI,40000

## Calculator C#

Create a class called Calculator which contains methods for arithmetic operations such as Addition, Subtraction ,Multiplication and Division. Division method should return the Quotient and Remainder(hint:use out parameter).Follow the method signatures as given below:public int Addition(int a, int b)public int Subtraction(int a, int b)public int Multiplication(int a, int b)public double Division(int a, int b, out double remainder). //The method should return the Quotient and Remainder should be passed through the out parameter.The methods should return the appropriate result.Create a class Program with Main Method . Prompt for 2 operands and operator from the user, Call the appropriate method for operation and display the results.Note:Don’t create any new namespace.Create classes with pubic access specifierSample InputEnter the operator+Enter the operands1210Sample OutputResult of 12 + 10 is 22Sample InputEnter the operator/Enter the operands112Sample OutputResult of 11 / 2 is 5Remainder =1Sample InputEnter the operator&Enter the operands1210Sample OutputInvalid Operator

## Sieve of Eratosthenes

Sieve of Eratosthenes

A prime number is any integer greater than 1 that’s evenly divisible only by itself and 1. The Sieve of Eratosthenes is a method of finding prime numbers. It operates as follows:

a) Create a primitive-type boolean array with all elements initialized to true. Array elements with prime indices will remain true. All other array elements will eventually be set to false.b) Starting with array index 2, determine whether a given element is true. If so, loop through the remainder of the array and set to false every element whose index is a multiple of the index for the element with value true. Then continue the process with the next element with value true. For array index 2, all elements beyond element 2 in the array that have indices which are multiples of 2 (indices 4, 6, 8, 10, etc.) will be set to false; for array index 3, all elements beyond element 3 in the array that have indices which are multiples of 3 (indices 6, 9, 12, 15, etc.) will be set to false; and so on.When this process completes, the array elements that are still true indicate that the index is a prime number. These indices can be displayed. Write an application that uses an array of 1,000 elements to determine and display the prime numbers between 2 and 999. Ignore array elements 0 and 1.

## Saving Account Class

Saving Account Class

Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12—this interest should be added to savingsBalance. Provide a static method modifyInterestRate that sets the annualInterestRate to a new value. Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers. Next, set the annualInterestRate to 5%, calculate the next month’s interest and print the new balances for both savers.

## Property Tax Raptor

What to Submit: Complete the following two program in Raptor and submit the two .rap filesProperty Tax (50 points) : a county collects property taxes on the assessment value of property, which is 60 percent of the property’s actual value. For example, if an acre of land is valued at $10,000, its assessment value is $6, 000. The property tax is then 64 cents for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $38.40. Design a modular program that asks for the actual value of a piece of property and displays the assessment value and property tax. The program contains three modules:In the main module, initialize assessmentValue and propertyTax to 0, ask user to enter actualValue of a piece of property, call a module and name it as getAssessmentValue module, call another module and name it getPropertyTax, After that, use Output symbols to display actualValue, assessmentValue, and propertyTax.

In the module getAssessmentValue, calculate assessmentValue by multiplying actualValue by 0.6.

In the module getPropertyTax , calculate propertyTax by dividing assessmentValue by 100 and then multiplying by 0.64.

## Game of Craps

Game of Craps

Write an application that runs 1,000,000 games of craps code in discussed in chapter 6 (also given in appendix 1 of this assignment file) and answers the following questions:

a) How many games are won on the first roll, second roll, …, twentieth roll and after the twentieth roll?

b) How many games are lost on the first roll, second roll, …, twentieth roll and after the twentieth roll?

c) What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino games. What do you suppose this means?]

d) What is the average length of a game of craps?

e) Do the chances of winning improve with the length of the game?

Appendix 1 – Game of Craps Code

// Fig. 6.9: Craps.java

// Craps class simulates the dice game craps.

import java.util.Random;

public class Craps

{

// create random number generator for use in method rollDice

private Random randomNumbers = new Random();

// enumeration with constants that represent the game status

private enum Status { CONTINUE, WON, LOST };

// constants that represent common rolls of the dice

private final static int SNAKE_EYES = 2;

private final static int TREY = 3;

private final static int SEVEN = 7;

private final static int YO_LEVEN = 11;

private final static int BOX_CARS = 12;

// plays one game of craps

public void play()

{

int myPoint = 0; // point if no win or loss on first roll

Status gameStatus; // can contain CONTINUE, WON or LOST

int sumOfDice = rollDice(); // first roll of the dice

// determine game status and point based on first roll

switch ( sumOfDice )

{

case SEVEN: // win with 7 on first roll

case YO_LEVEN: // win with 11 on first roll

gameStatus = Status.WON;

break;

case SNAKE_EYES: // lose with 2 on first roll

case TREY: // lose with 3 on first roll

case BOX_CARS: // lose with 12 on first roll

gameStatus = Status.LOST;

break;

default: // did not win or lose, so remember point

gameStatus = Status.CONTINUE; // game is not over

myPoint = sumOfDice; // remember the point

System.out.printf( “Point is %d\n”, myPoint );

break; // optional at end of switch

} // end switch

// while game is not complete

while ( gameStatus == Status.CONTINUE ) // not WON or LOST

{

sumOfDice = rollDice(); // roll dice again

// determine game status

if ( sumOfDice == myPoint ) // win by making point

gameStatus = Status.WON;

else

if ( sumOfDice == SEVEN ) // lose by rolling 7 before point

gameStatus = Status.LOST;

} // end while

// display won or lost message

if ( gameStatus == Status.WON )

System.out.println( “Player wins” );

else

System.out.println( “Player loses” );

} // end method play

// roll dice, calculate sum and display results

public int rollDice()

{

// pick random die values

int die1 = 1 + randomNumbers.nextInt( 6 ); // first die roll

int die2 = 1 + randomNumbers.nextInt( 6 ); // second die roll

int sum = die1 + die2; // sum of die values

// display results of this roll

System.out.printf( “Player rolled %d + %d = %d\n”,

die1, die2, sum );

return sum; // return sum of dice

} // end method rollDice

} // end class Craps

## EmployeeData CPP

In this homework assignment, you will write a C++ program to store employee data in a List (ADT).You can study List(ADT) functions from your textbook at Chapter 3. Every employee has id, first name, last name, phone number, email address, salary. EmployeeTypeAttributeemployee_idintFirst namestringLast namestringPhone numberstringEmail addressstringsalarydoubleYou will implement the Employee class in a studentName.cppfile. I expect you to have1 file: studentName.cpp.So, Employee class definition will be in the studentName.cppfile.You will read the data from a employeeData.txt file given in the homeworkdescription in Canvas.The data is separated by space, you don’t need to do any string split operations.Once you start reading data from the file, the employees will be insertedto List ordered byemployee_id.This means a new employee may be inserted between two existing employees in the list. At this point, you should use the “insert” function of List class. The insert function takes an iterator as an input to identify the correct position. You can refer Chapter 3.3.1in the textbook. Please note that I do not accept if you add all the employees in random order and use a sort function later. If youdo it, you will lose substantial amount of credit. Whenyou insertall employees, you will print your employee List starting from the first element to the last. You should print all information of each employee. Here once you print the list, you should see employee information ordered based on id.

## Coupon Collector

Solve the following problem using arrays:

Part A: Coupon collector is a classic statistic problem with many practical applications. The problem is to pick objects from a set of objects repeatedly and determine how many picks are needed for all the objects to be picked at least once. A variation of the problem is to pick cards from a shuffled deck of 52 cards repeatedly and find out how many picks are needed before you see one of each suit. Assume a picked card is placed back in the deck before picking another. Write a program to simulate the number of picks needed to get total of four cards from each different suit and display the four cards picked (it is possible that a card may be picked twice).Here is a sample run of the program:

Queen of Spades

5 of Clubs

Queen of Hearts

4 of Diamonds

Number of picks: 12Sample run explanation: As you see in the above run, 12 picks are made to get the four cards from different suits. The other 8 picks (12-4=8) were from the same previously picked suits, so they are not printed. So we continue picking a card until we see at least one card from each of the for suits.Note: The card pick is with replacement, meaning that when you pick a card from the deck of 52 card, you put it back in the deck. There is chance to see the previously selected card again.

Part B: Put part A in a for loop and repeat it 10,000 times and report the average number of total picks we should have to see 4 cards from different suits.