Questions
Write a function that takes a string, returns void and has the effect of shifting the...

Write a function that takes a string, returns void and has the effect of shifting the vowels of the string to the left. For example, if the input string was “hello class”, then after calling this function the string should contain “holla cless” (note that the first vowel is moved to the location of the last vowel). You can use an auxillary string if you want, but a nicer solution would work “in-place”

In: Computer Science

using C++ 24. Using Files—Total and Average Rainfall Write a program that reads in from a...

using C++

24. Using Files—Total and Average Rainfall
Write a program that reads in from a file a starting month name, an ending month name,
and then the monthly rainfall for each month during that period. As it does this, it should
sum the rainfall amounts and then report the total rainfall and average rainfall for the
period. For example, the output might look like this:
During the months of March–June the total rainfall was 7.32 inches and the average
monthly rainfall was 1.83 inches.
Data for the program can be found in the Rainfall.txt file.
Hint: After reading in the month names, you will need to read in rain amounts until
the EOF is reached, and count how many pieces of rain data you read in.

You can use note pad to create a Rainfall.txt with the following data:

January
May
1.35 2.15 3.03 4.41 5.41

Please note that you must read the first line of the file as starting month and second line as ending month. Please do not hard code the starting and ending month into your program.

test case

During the months of January-May the total
rainfall was 16.35 inches and the average monthly
rainfall was 3.27 inches.

In: Computer Science

I need 40 question for requirements for Library System Management. Put 40 question please that we...

I need 40 question for requirements for Library System Management. Put 40 question please that we can get requirements for LSM.

In: Computer Science

Write the IEEE floating point representation (single precision) of 3.75 (Show all your steps to get...

Write the IEEE floating point representation (single precision) of 3.75 (Show all your steps to get full credit).

In: Computer Science

Having trouble getting started on this Overview As a programmer, you have be asked by a...

Having trouble getting started on this

Overview

As a programmer, you have be asked by a good friend to create a program that will allow them to keep track of their personal expenses. They want to be able to enter their expenses for the month, store them in a file, and then have the ability to retrieve them later. However, your friend only wants certain people to have the ability to view his or her expenses, so they are requesting that you include some sort of login functionality.

Instructions

For this challenge, you will start this application for your friend by concentrating on the login functionality. You will have a standard report in a text file where you will build login functionality to access. Below you will find the step by step instructions on how to develop this application.

  1. Declaring Variables - You will start the application by declaring the following variables:
    1. username - initialized with an empty string to store the username entered by the user
    2. password - initialized with an empty string to store the password entered by the user
    3. repeat - initialized with the letter 'y' to control the looping of the program
    4. passwordLength - intialized with the number 8 to validate password length
    5. Four flags set to false named hasAmpersand, hasValidLength, isValidUsername, and isValidPassword
  2. Display the program header as shown in the images below
  3. Your program must allow the program to repeat without re-displaying the program header.
  4. You must obtain the username from the user then check to see if the username contains the @ symbol. If does, set the hasAmpersand flag to true and allow the program to continue. If it doesn't, alert the user that it is an invalid email and use the continue command to skip the rest of the code and repeat the program.
  5. Obtain the user password and use a while loop to make sure that the user has entered a password greater than the number stored in the passwordLength variable. After the password has been validated to be greater than the stated password length, change the hasValidLength flag to true.
  6. You will then use the hasAmpersand and hasValidLength flags to confirm whether or not to open the logins.txt file to confirm that this login information is present in the file. This is when you would change the appropriate isValid flags to state that they are in the file. (HINT: You can check first that the username is in the file, if not, then there is no need to check for the password.) If the username is not in the file, use the break statement to end the program as shown below.
  7. The report stored in the PersonalExpense.txt file should only be display if both the username and password is correct.
  8. The text files for this application are attached to the Dropbox. You may download and add them to your solution. Or feel free to create your own login and report pages

what I have so far:

hasAt=False

while (not hasAt):

username= input("what is your username?")

if "@" not in username:

print ("wrong username")

print ("try again loser")

else:

password= input ("what is your password?")

hasAt=True

In: Computer Science

1) Only a single main class is required 2) The main class must contain a static...

1) Only a single main class is required

2) The main class must contain a static method called "getInputWord" that prompts a user to input a word from the keyboard and returns that word as a String. This method must use "JOptionPane.showInputDialog" to get the input from the user (you can find info about JOptionPane in JavaDocs)

3) The main class must contain a static method called "palindromeCheck" that takes a String as an input argument and returns a boolean indicating whether or not that String is a palindrome. This method must utilize a Stack data structure to determine whether the word is a palindrome. Hint: Use the charAt() method of the String class to access each character of the word

Flow of the Program:

1) Read in a word from the user by calling the "getInputWord" method

2) Check if the word is a palindrome using the "palindromeCheck" method

3) Output the result to the screen using "JOptionPane.showMessageDialog" (you can find info about JOptionPane in JavaDocs)

In: Computer Science

Write a simple matching coefficient and jaccard similarity code in python. For a example x =...

Write a simple matching coefficient and jaccard similarity code in python.

For a example x = 10101 and y = 00101 what is the code to check those similarities in python?

In: Computer Science

SQL Assignment: Provide a made-up scenario about when a database trigger could be used. There is...

SQL Assignment:

Provide a made-up scenario about when a database trigger could be used. There is no need to provide the syntax to create the trigger, as this would differ depending upon the actual design of the database. Only provide the scenario of when a trigger could be used.

In: Computer Science

Java Math Tutor: Write a program that displays a menu as shown in the sample run....

Java

Math Tutor:

Write a program that displays a menu as shown in the sample run. You can enter 1, 2, 3, or 4 for choosing an addition, subtraction, multiplication, or division test. After a test is finished, the menu is redisplayed. You may choose another test or enter 5 to exit the system. Each test generates two random single-digit numbers to form a question for addition, subtraction, multiplication, or division. For a subtraction such as number1 – number2, number1 is greater than or equal to number2. For a division question such as number1 / number2, number2 is not zero.

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

Main menu 1:

Addition 2:

Subtraction 3:

Multiplication 4:

Division 5:

Exit Enter a choice: 1

What is 1 + 7? 8 Correct

Continue? (y/n) y

Enter a choice: 3

What is 2 * 3? 7

Your answer is wrong.

The correct answer is 6.

Continue? (y/n) n

Good bye!

In: Computer Science

10) Write the one line of code to find this |-13.75| = 13.75 11) Write a...

10) Write the one line of code to find this |-13.75| = 13.75

11) Write a function declaration for a function called Diff that takes two agruements of type int returns the difference of the two integers.

12) Write a main function which calls the above function and display the difference returned by the Diff function.

13) We need three functions
One which is taking length, width, and height to calculate volume of Rectangular prism and returns a double value.
One which is taking an int value and returns true it is multiple of 5. (Bool function)
One which is not taking no arguement but ask the user’s response for a rating. (User’s response should be a character)
It should return that character of user’s choice.
(a) Give the function declaration for the above 3 conditions

(b) Make function calls inside main for each of the above 3 functions.


Help is needed, please and thank you!

In: Computer Science

What additional features of a MEAN stack applications have to be included in this course and...

What additional features of a MEAN stack applications have to be included in this course and why?

Provide references. 5 points: 3 points for the original post and one point for a meaningful reply.

In: Computer Science

* Javascript * Describe an advantage or why someone would choose this loop type over another....

* Javascript *

  1. Describe an advantage or why someone would choose this loop type over another. Some things to consider and ask yourself:
    When would you use a for loop over a while loop? When would you use a while loop over a for loop? When would you use a do...while loop over a while loop?
  2. Give an example that fits the loop type's optimal use case (short answer, not code). Example scenario for a for loop (do not copy, be creative):
    Given an array of 100 numbers, iterate over each element/index and calculate the sum.

In: Computer Science

Using HTML: Create a Book of the Month Club Web site. The home page should describe...

Using HTML: Create a Book of the Month Club Web site. The home page should describe the current month's selection, including book title, author, publisher, ISBN, and the number of pages. Create separate Web pages for book selections in each of the last three months. Add links to the home page that opens each of the three Web pages. Save the home page as BookClub.html, and save the Web Pages for previous months using the name of the month.

BOOK: Principles of HTML, XHTML, and DHTML: The Web Technologies Series
CHAPTER 2 Building, Linking, Publishing Basic Web Pages
PROBLEM 2-1

In: Computer Science

PYTHON A Class for a Deck of Cards We will create a class called Card whose...

PYTHON

A Class for a Deck of Cards

We will create a class called Card whose objects we will imagine to be representations of playing cards. Each object of the class will be a particular card such as the '3' of clubs or 'A' of spades. For the private data of the class we will need a card value ('A', '2', '3', ... 'Q', 'K') and a suit (spades, hearts, diamond, clubs).

Before we design this class, let's see a very simple main() (also called the client, since it uses, or employs, our class) that instantiates a few Card objects and displays their values on the screen. We want to do a lot of fun things with our Card, but not yet. We start very carefully and slowly.

from enum import Enum


def main():
    card1 = Card()
    card2 = Card('5')
    card3 = Card('9', Suit.HEARTS)
    card4 = Card('j', Suit.CLUBS)
    card5 = Card('1', Suit.DIAMONDS)

    if not card2.set(2, Suit.CLUBS):
        print("GOOD: incorrect value (2 (int), CLUBS) passed to Card's set()\n")
    if not card2.set('2', Suit.CLUBS):
        print("BAD: incorrect value ('2', CLUBS) passed to Card's set()\n")

    print(str(card1) + "\n" + str(card2) + "\n" +
          str(card3) + "\n" + str(card4) + "\n"
          + str(card5) + "\n")

    card1 = card4

    # test assignment operator for objects
    print("after assigning card4 to card1:")
    print(str(card1) + "\n" + str(card4)
          + "\n")

We can't run this main() without embedding it into a full program that has the Card class definition, but let's look at a copy of the run anyhow, so we can see what the correct output for this program should be:

GOOD: incorrect value (2 (int), CLUBS) passed to Card's set()

(A of Spades)
(2 of Clubs)
(9 of Hearts)
(J of Clubs)
(A of Spades)

after assigning card4 to card1:
(J of Clubs)
(J of Clubs)

We can learn a lot about what class Card must be and do by looking at main() and the run. Let's make a list of things that we can surmise just by looking at the client.

  • We are instantiating several Card objects and sending a varying number of arguments to the constructor. For example, look at this code fragment:
   card1 = Card()
   card2 = Card('5')
   card3 = Card('9', Suit.HEARTS)
   card4 = Card('j', Suit.CLUBS)
   card5 = Card('1', Suit.DIAMONDS)

We see that card1 is instantiated with no arguments. This tells us that the class has a constructor (always __init__()) that does not require any arguments. Do you remember how that's done? Right! Either a default constructor (no formal parameters) or a constructor with all default parameters. So it must be one of those types.

However, we also see that card2 is providing the constructor with one argument and card3, card4 and card5 with two arguments. So, we must also have at least a 2-parameter constructor, and whatever number of parameters it has, they must all be default parameters (not counting the self parameter).  

  • Looking again at that same fragment, we see that those Card objects which are being instantiated with two arguments are supplying both a value and a suit:
       card3 = Card('9', Suit.HEARTS)
    The first argument, the value, is passed to the constructor as what data type? It is surrounded by quotes '5', '9', 'j', so it must be a string. (See Note On String Delimiters, below.) But the suit is a little odd. It is a construct like Suit.CLUBS or Suit.DIAMONDS with no quotes around it. Words without quotes in Python usually refer to variable names, but in this case, that's not what they are. Here we are using enumerated or enum types. You may not have had enums in your first course, so you will learn about them this week.
  • A set() method is used to assign values to a Card object, e.g., card1.set(2, clubs). Such instance methods are called mutators. This works the same way as a 2-parameter constructor but is used after, not during, the birth (construction) of the object. Furthermore, the set() method seems to be returning a bool value because we are treating the return value as if it were either True or False, e.g., if not card2.set(2, Suit.CLUBS)... . Apparently, this mutator method is returning a True if the assignment was successful and a False, otherwise.
  • By looking at the error message printed in the run, we can see that most ints (like 2) are not allowed to be passed to the constructor as the Card value. We have to pass a string, like '2', to represent the "deuce" (card with value '2'), for instance. The mutator method must be checking to make sure that the character passed in is between an ASCII '2' and an ASCII '9', or is one of the picture or ten Card characters 'A', 'K', 'Q', 'J', 'T'.  
  • It looks like a picture or 10 Card value passed in as a lower case char ('a','k', 'q', 'j', 't') is being up-cased (converted to upper case) by the mutator or constructor.
  • The assignment operator works as it should:  card1 = card4 assigns the object to which the reference card4 points to the reference card1, so that both references then point to the same object — a technique called aliasing. We'll prove this in a later version of the client today.
  • Finally, there is a __str__() instance method. In CS 3A, we learned that this is a special instance method that we write for most of our classes to help our clients use objects sometimes like strings(print( my_object)), and sometimes like primitive (immutable) types (print( "My object is" + str(my_object)) .

In: Computer Science

(Use C++ language) CREATE A PROGRAM CALLED and or not.cpp THAT: ASKS USER FOR AGE Note:...

(Use C++ language) CREATE A PROGRAM CALLED and or not.cpp THAT: ASKS USER FOR AGE Note: you must be 18 or older to vote && is the symbol for And | | is the symbol for Or ! is the symbol for Not USE AND, OR, OR NOT TO SEE IF THEY'RE OLD ENOUGH TO VOTE and display appropriate message USE AND, OR, OR NOT TO SEE IF THEY ENTERED A NUMBER LESS THAN 0 and display appropriate message USE AND, OR, OR NOT TO SEE IF THEY ENTERED 18 or higher and display appropriate message DISPLAY A MENU OF CHOICES: 1. Democrat 2. Republican 3. Independent ASK USER TO ENTER THE NUMBER OF THEIR CHOICE USE IF STATEMENT WITH == TO CHECK THEIR CHOICE use a different message for each choice if they enter something other than 1,2, or 3 use AND, OR, or NOT to find out display a message

In: Computer Science