A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that takes a float as a parameter, representing the number of feet walked, and returns an integer that represents the number of steps walked. Then, write a main program that reads the number of feet walked as an input, calls function feet_to_steps() with the input as an argument, and outputs the number of steps. Use floating-point arithmetic to perform the conversion.
Q: 2. Consider the following program: Winclude using namespace std; int main() cout << "Any…
A: Output: A. To print the text without any newline break, remove \n from everywhere from court…
Q: 2. Write a printf or scanf statement for each of the following: e) Read characters into array s…
A: The problem is based on taking the input from the user until the given condition is not satisfied.
Q: (Converting Strings to Integers for Calculations) Write a program that inputs six strings t hat…
A: Since you have not mentioned the sample output, so we have provided the output in the most…
Q: 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first…
A: The answer is given below.
Q: 3. Write the function to evaluate/compute the following, i.e. the value of Pl given by the…
A: The above question is solved in step 2 :-
Q: Convert to binary - methods Write a program that takes in a positive integer as input, and outputs a…
A: import java.util.Scanner; public class LabProgram // the class { // user define…
Q: 3. Write the function to evaluate/compute the following, i.e. the value of Pl given by the…
A: The function to find the value of PI using Leibniz algorithm would be:
Q: 10.25 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3…
A: The above code is solved using Python Language below:
Q: 11.11 LAB: Drawing a right side up triangle Write a recursive function called draw_triangle) that…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOTS------------
Q: 8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Electric 558…
A: #include <iostream>#include <fstream>using namespace std; double calculation(string…
Q: 5.18 (Even or Odd) Write a program that inputs a series of integers and passes them one at a time to…
A: EXPLANATION - Firstly declare variables that are used in program . Then take input from user about…
Q: From a Given Line of Text) Write a program that inputs a line of text and a given word. The program…
A:
Q: XOR AX,AX WILL DO THE FOLLOWING FUNCTION
A: Xor gives output 1 if both are same XOR AX,AX ax xor with ax then AX=11111111
Q: X15: inOrder Write a function in Java that implements the following logic: Given three ints, a, b,…
A: Given : To Write a function in Java that implements the following logic: Given three ints, a, b,…
Q: 18 - What is the output of the following code?
A: The output of the following code is - Good Luck good luck
Q: 5.22 In Python: Write a program whose input is two integers and whose output is the two integers…
A: Define the functions to swap the values. Declaring the variables including a temporary variable…
Q: 8.15 (Displaying a Sentence with Its Words Reversed) Write a program that inputs a line of text,…
A: Let us consider a C program that inputs a line of text, tokenizes the line with function strtok and…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: [Note: please use proper indentation to avoid erros. snapshots of program code are provided in step…
Q: Python 3.7.4 Given that add, a function that expects two int parameters and returns their sum, and…
A: The statement is given below,eurasia_sales = add(euro_sales, asia_sales)
Q: (7) Implement the ShortenSpace() function. ShortenSpace() has a string parameter and updates the…
A: Programming language is missing in the question. The below program is provided in C language. If you…
Q: Q1 (i): Write a C++ function which computes the square of an integer. (ii): Modify your previous…
A: 1)C++ function which computes the square of an integer: #include<iostream> using…
Q: iterse def squares_intersect (s1, 82): An axis-aligned square on the two-dimensional plane can be…
A: # TEXT CODE:
Q: SOB 35 - (Block 2 - material covered in Week 13) Write a function that takes a list containing…
A: I give the code in Python along with output and code screenshot
Q: C++ function, allLargestindices, that takes as input paramneters, Int array and Size, that takes as…
A: #include <iostream>using namespace std;//function takes integer array and its size//then…
Q: 1. Write a Swift function that takes an array as a parameter and returns a boolean value whether the…
A: Write a Swift function that takes an array as a parameter and returns a boolean value whether the…
Q: 18. You have a group of friends coming to visit for your high school reunion, and you want to take…
A: public class Restaurant{ public static void main(String[] args) { Scanner sc=new…
Q: void add(int *ptr1, int *ptr2, int *val) { *ptr1 += *val; *ptr2 += *val; }
A: #include <stdio.h> void add(int *ptr1, int *ptr2, int *val); // defination of add function…
Q: public class Turn{public static void main(String[] args){// Different initial values will be used…
A: Equations that are used to replace the value of variable x and y: - The initial values of the…
Q: The word limit for this explanation is 350.
A: Final variable: ==>In general we represent a variable as final variable using "final" keyword.…
Q: Please answer in C++ Write a program that takes in a positive integer as input, and outputs a…
A: Let's solve the question step by step and understand the algorithm: 1. In the main function input a…
Q: 1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some…
A: Program code: //include the required header files #include<iostream> //std using namespace…
Q: isplaying a Sentence with Its Words Reversed
A: Program structure Include header files <stdio.h> and <string.h> to perform input/output…
Q: 7.18 LAB: A jiffy A jiffy" is the scientific name for 1/100th of a second. Define a function named…
A: Algorithm: 1. Take Input. 2. Read the function and return userJiffies/100. 3. Display Output to 3…
Q: using chapters 1 to 10 from the book C how to program edition 8
A: #include <stdio.h>union integer{ char c; short s; long b; int i;};int main(void){…
Q: (Counting the Number of Words in a String) Write a program that inputs several lines of t ext and…
A: A C program is as follows, File name: “main.c” #include <stdio.h> #include <string.h> //…
Q: 5.2 Write a function in Javascript to take input a matrix as a parameter and returns whether the…
A: As per the given question we need to write a function : Input parameter : A matrix To check if the…
Q: 8.6.4 The 0 = xD Operator This operator consists of first taking the derivative of a function and…
A: Operator can be defined by its function. Derivative of a function can be represented by D. Where…
Q: 5.28 LAB: Convert to binary - functions Write a program that takes in a positive integer as…
A: Since, here no programming language is specified so, we are providing the solution in the python…
Q: 39. 6.49 (Pass-by-Value vs. Pass-by-Reference) Write a complete C++ program with the two alternate…
A: #include <iostream>using namespace std; // Pass by valueint tripleByValue(int count){ count…
Q: 5.14 For each of the following sets of integers, write a single statement that will print a number…
A: a) Program code: //import required data package import java.util.Random; //main class public…
Q: 11. Write a Python function to check whether a number is perfect or not. Go to the editor According…
A: Answer in step2
Q: b In multiplication, assume that leading zeroes are not allowed. Write a program in C++ to help…
A: Required: In multiplication, assume that leading zeroes are not allowed. Write a program in C++ to…
Q: 7. Write a function that evaluates the area of a pentagon. Use "math.pi", for pi, and "math.sqrt"…
A: Area of pentagon Pentagons can be convex or concave, regular or irregular. One with equal sides and…
Q: 6.26 LAB: Exact change - functions Write a program with total change amount as an integer input…
A: Given: 6.26 LAB: Exact change - functions Write a program with total change amount as an…
Q: Print Patterns Using Loops] by c Write down a program to initialize an integer array ‘a[ ]’ of size…
A: Program code is given below #include<stdio.h>#include <stdlib.h> void enterValues(int…
Q: 7. Write a function that evaluates the area of a pentagon. Use "math.pi", for pi, and "math.sqrt"…
A: code snippet:
Q: 2. Modular arithmetic Write a function that returns the result of any integer modulo of n (i.e.,…
A: Actually, function is a group of statements. The given information is: /* precondition: n is greater…
Q: 7.18 LAB: A jiffy Ajiffy' is the scientific name for 1/100th of a second. Define a function named…
A: Output: 15.250.152
6.21 LAB: Step counter
A pedometer treats walking 1 step as walking 2.5 feet. Define a function named feet_to_steps that takes a float as a parameter, representing the number of feet walked, and returns an integer that represents the number of steps walked. Then, write a main program that reads the number of feet walked as an input, calls function feet_to_steps() with the input as an argument, and outputs the number of steps.
Use floating-point arithmetic to perform the conversion.
Ex: If the input is:
150.5
the output is:
60
The program must define and call the following function:
def feet_to_steps(user_feet)
Use Python, please.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Project 2 Use Netbeans, to write a simple java program using the following data structures: 1. Stack by Linked List2. Circular Queue by Array The program should implement the following functions: 1. Insert2. Read/Print3. Remove an item4. Delete (the entire list) On the initial start of the program, users should be prompted for at least five elements into the list. After which they should be presented with options that will allow them to perform the functions defined above. Note that exception handling must be implemented. Screenshots of the cods as proof of its implementation should be includedUsing Dr-Racket, what is the purpose of the number function?(define (number n)(local [(define (abstract int)(* int 11))] (build-list n abstract))) A) Create a list of the first n multiples of 11 starting at 11. B) Create a list of the first n multiples of 11 starting at 0. C) Create a list of the first n multiples of 11 starting at 1. D) Create a list of the first 11 multiples of n starting at 1. E) Create a list of the first 11 multiples of n starting at 0.F) Create a list of the first 11 multiples of n starting at n.The People class holds an unsorted list of humans. Initially, this list is empty. Existing Human objects may be added to the list using an insert method. Upon inserting a Human object, it is added to the array at the next available position and the position value in incremented. If the position value is equal to the size value, do not insert the Human. Instead, throw an exception that your driver can catch to print an error that the People object is full. Create a People class with the following features: Each People object has a statically allocated array of Human objects. Size attribute representing the maximum size of the array. Position attribute representing the next free position in the array. Default constructor with no arguments. Search method that takes a string argument and returns a Human object. This method returns the first Human object with a name matching the string argument. In other words, pass the name of a Human as a string, search the list of humans for…
- Extend the class linkedListType by adding the following operations:a. Write a function that returns the info of the kth element of the linkedlist. If no such element exists, terminate the program.b. Write a function that deletes the kth element of the linked list. If nosuch element exists, output an appropriate message. Provide the definitions of these functions in the class linkedListType. Also writea program to test these functions. (Use either the classunorderedLinkedList or the class orderedLinkedList to testyour function.) Note: Code in c++Implement a class representing a circular sorted linked list. The class must have the following requirements: The linked list and the nodes must be implemented as C++ templates First must point to the largest value in the list It must include a constructor, a destructor, a copy constructor and an operator= It must include functions to insert a given item, delete a given item, search for a given item, check if the list is empty, return the length of the list and print the list (from smallest to largest) Hint: Use the menu-driven program of the linked list to test all the functions in your class. Screenshot the output and make comments on each area on the program.a. Add the following operation to the class orderedLinkedList:void mergeLists(orderedLinkedList<Type> &list1,orderedLinkedList<Type> &list2);//This function creates a new list by merging the//elements of list1 and list2.//Postcondition: first points to the merged list// list1 and list2 are emptyConsider the following statements:orderedLinkedList<int> newList;orderedLinkedList<int> list1;orderedLinkedList<int> list2;Suppose list1 points to the list with the elements 2 6 7, and list2 points to the list with the elements 3 5 8. The statement newList.mergeLists(list1, list2); creates a new linked list with the elements in the order 2 3 5 6 7 8, and the object newList points to this list. Also, after the preceding statement executes, list1 and list2 are empty. b. Write the definition of the function template mergeLists to implement the operation mergeLists.
- 1) When an allocator gets a request for nn bytes and finds a block of size mm, if m > nm>n then the block must be split. True or False 2) Coalescing refers to moving allocated blocks to create larger regions of free space. True or False 3) Segregated free lists divide blocks into different size classes, but some classes may contain more than one block size. True or FalseCreate a template class List that contain a dynamic array of template type and an integer variable of size. Set the size of the array in constructor. Include insert, show and Find Max and Find Min functions in the class. Find Max and Find Min functions return the maximum/minimum value stored in the array. Define all the functions outside the class. Test the class for at least two datatypes. In c++During the sockets lab we cast the second parameter from a struct sockaddr_in to a struct sockaddr. struct sockaddr_in address; /* ... */ bind(server_fd, (struct sockaddr*)&address, sizeof(address)) This provides a limited form of polymorphism: bind only needs the first few fields of its struct, and both struct sockaddr_in and struct sockaddr have the same fields at those addresses. Consider the following example: typedef struct { float x; float y; float z; } point3D; typedef struct { float x; float y; } point2D; float distance(point2D *a1, point2D *a2) { /* ... */ } int main() { point2D a = { .x = 2.1, .y = 3.0 }; point3D b = { .x = 4.1, .y = 4.3, .z = 4.0 }; // Call distance function with a and b } How would you pass a and b to the distance function? If several work, pick one that will not create warnings. A. distance(a, b); B. distance(a, (point2D)b); C. distance(&a, &b); D. distance(&a, &(point2D)b); E. distance(&a, (point2D*)&b); F. none of…
- Program #11. Show the ArrayStackADT interface 2. Create the ArrayStackDataStrucClass<T> with the following methods: default constructor, overloaded constructor, copy constructor, initializeStack, isEmptyStack, isFullStack, push, peek, void pop 3. Create the PrimeFactorizationDemoClass: instantiate an ArrayStackDataStrucClass<Integer> object with 50 elements. Use a try-catch block in the main( ) using pushes/pops. 4. Exception classes: StackException, StackUnderflowException, StackOverflowException 5. Show the 4 outputs for the following: 3,960 1,234 222,222 13,780Add the following operation to the class orderedLinkedList: void mergeLists(orderedLinkedList<Type> &list1, orderedLinkedList<Type> &list2); //This function creates a new list by merging the //elements of list1 and list2. //Postcondition: first points to the merged list // list1 and list2 are empty Consider the following statements: orderedLinkedList<int> newList; orderedLinkedList<int> list1; orderedLinkedList<int> list2; Suppose list1 points to the list with the elements 2 6 7, and list2 points to the list with the elements 3 5 8. The statement newList.mergeLists(list1, list2); creates a new linked list with the elements in the order 2 3 5 6 7 8, and the object newList points to this list. Also, after the preceding statement executes, list1 and list2 are empty. 2. Write the definition of the function template mergeLists to implement the operation mergeLists.Implement a password cracker using C++ Source code must be well documented (comments). You will be provided with an unsalted hashed password file that contains password hashes for different users. Also, you will be provided with a dictionary file(in clear text) containing the most common passwords. You should implement the offline dictionary attack by trying SHA1 and SHA2 algorithms. Also, your program should brute force all possible alphanumeric(only small cases) passwords from 1 to 4 characters using SHA1 and SHA2 algorithms against all hashed passwords left from the offline dictionary attack (if any).