Answer:
c. Purchase a wireless expansion card and install it in your system.
d. Purchase a USB wireless adapter and connect it to the computer by way of a USB port.
Explanation:
Assuming you purchased a new desktop computer that does not have wireless capability, and then you decide that you want to use a wireless connection to the Internet.
The least expensive ways to upgrade your system to wireless is to;
1. Purchase a wireless expansion card and install it in your system. The expansion card is a slot on the motherboard of a computer which allow users use an additional feature such as network, video, sound that may not be available before.
2. Purchase a USB wireless adapter and connect it to the computer by way of a USB port.
Write a program that will convert a distance provided in inches to a distance in yards, feet and inches. The program will ask the user to input a distance in inches as a whole number. It will convert the distance provided into yards, feet and inches. Then it will display the distance in yards, feet and inches. For example, the program will convert 50 inches into 1 yard, 1 ft and 2 inches. See the Testing section for test data.
Answer:
Here is the C++ program:
#include <iostream> // to use input output functions
using namespace std; //to access objects like cin cout
int main() { //start of main method
int inches, feet, yards; // declare variables to hold values of inches, feet and yards
cout << "Enter distance in inches: " //prompts user to enter distance in inches
cin >> inches; //reads value of inches from user
feet = inches/12; // divides value of inches (performs integer division) by 12 and store result in feet
inches = inches%12; //takes modulo of inches with 12 and stores the result in inches variable
yards = feet / 3; // divides value of feet with 3 and stores result in yards
feet = feet % 3; //take modulo of value of feet with 3 and stores result in feet variable
cout<<"yards: "<<yards<<endl<<"feet: "<<feet<<endl<<"inches: "<<inches; }
//displays the value of inches into yards feet and inches
Explanation:
I will explain the program with an example:
Suppose the user enters 50 as distance.
inches = 50
feet = inches/12; this statement becomes:
feet = 50/12
The answer of division is 4.166667 but as we are doing integer division so there is no fractional part rather it is represented as whole number and remainder is ignored. So,
feet = 50/12
feet = 4
inches = inches%12; next is this statement which becomes:
inches = 50 % 12
% operator basically computes the remainder. So when 50 is divided by 12 it gives the quotient 4 in integer division and gives 2 as remainder. But we need the value of remainder so,
inches = 50 % 12
inches = 2
yards = feet / 3; next is this statement which becomes:
yards = 4 / 3
Since the value of feet computed in above steps is 4 so this value is divided by 3.
4/3 gives 1.333333 but as we are doing integer division so there is no fractional part rather it is represented as whole number and remainder is ignored. So,
yards = 4 / 3
yards = 1
feet = feet % 3; next is this statement which becomes:
feet = 4 % 3
% operator basically computes the remainder. So when 4 is divided by 3 it gives the quotient 1 in integer division and gives 1 as remainder. But we need the value of remainder so,
feet = 4 % 3
feet = 1
Hence the input distance in inches i.e. 50 is converted to 1 yard, 1 ft and 2 inches as:
yards = 1
feet = 1
inches = 2
If you want to make the program more interactive by dislaying the value of yards, feet and inches as singular and plural then use these if statement in main() function:
if(yards<=1) //checks if value of yard is 1 or less
cout<<yards<<" yard"; //displays 1 yard in singular
else //if value of yard is greater than 1
cout<<yards<<" yards"; //place an "s" with yard to represent value greater than 1
cout<<endl;
if(feet<=1) //checks if value of feet is 1 or less
cout<<feet<<" foot"; //display the value with "foot" representing singular value
else //if value of feet is greater than 1
cout<<feet<<" feet"; //display the value with "feet"
cout<<endl;
if(inches<=1) //checks if value of inches is 1 or less
cout<<inches<<" inch"; //displays 1 inch in singular
else //if value of inches is greater than 1
cout<<inches<<" inches"; //place an "s" with yard to represent value greater than 1
The output of the program is attached.
Write a program that reads in a line of text and outputs the line with all the digits in all integer numbers replaced with 'x'. Please enter a line of text: My userID is john17 and my 4 digit pin is 1234 which is secret My userID is john17 and my x digit pin is xxxx which is secret Notes: 1. If a digits is part of a word, then the digit is not changed to an 'x'. For example, john17 is NOT changed to johnxx. 2. You may assume that the text entered by the user will contain only letters (upper case or lower case), digits and spaces. 3. Think how to break down your implementation to functions.
Answer:
import re
def secret_pin_digit( ):
user = input("Please enter a line of text: ")
search_values = re.findall( "\d", user )
for item in search_values:
if int( item ) == "NAN":
user.replace("item", "x")
print( user )
Explanation:
The python function program above prompts the user for a string specifying the user id, username and the user pin. The digits in the string are replaced with an "x". This is used to hide the pin of a user