Answer:
class Phone(object):
def __init__(self, model, partNumber, retailPrice):
self.model = model
self.part_number = partNumber
self.retail_price = retailPrice
def phone_specs(self):
print( "Phone model: {}\nPart number: {}\nRetail price: {}".format( self.model, self.part_number, self.retail_price))
phone1 = Phone("Nokia", "asd234", 200.0)
phone1.phone_specs()
Explanation:
A class is a blueprint of a data structure used to create objects of the same data types and methods. The Phone class is an object that creates an instance of the phone1 object. The phone_specs method is used to display the details of the phone1 object.
Answer and Explanation
In the United States of America, driver's licenses are issued by each individual state, territory.
In order for a driver to graduate from a learner's license to an operator's license, how many hours of driving you need to be documented is 50 hours, of which 10 hours must be at night.To move on to your intermediate driver's license, you must: Be at least 16 years old .
Answer:
Presentation.
Explanation:
NOTE: This question is incomplete and require additional details.
Answer:
The program is given below with appropriate comments for better understanding
Explanation:
1) LMC Program:
LDA A //Load A
SUB B //Subtract from A, B which is 0.
SKZ // skip next statement if A-B == 0 , which is A == 0 as B is zero.
JMP ENDIF // jump to ENDIF point if A not equal to 0, else this step is skipped.
OUT // some statement , not called if A != 0.
ENDIF LDA A // jump statement arrives here if A != 0.
HLT //HALT
2) LMC Program:
//input first number
INP
//store it at address 99
STA 99
//input second number
INP
//add it to value at 99
ADD 99
//store the resulting sum to 99
STA 99
//input third number
INP
//add the number to value at 99 address(which is the sum of first and second number)
ADD 99
//output sum
OUT
//halt
HLT
Answer:
#here is code in python.
#read number of shares
num_share = int(input("Enter number of shares:"))
#read purchase price
buy_p = float(input("Enter purchase price:"))
#read sell price
sell_p = float(input("Enter sale price:"))
#total buying cost
buy_cost=buy_p*1.03*num_share
#total selling cost
sell_cost=sell_p*0.97*num_share
#if net profit
if(sell_cost>buy_cost):
print("After the transaction, you made " +str(sell_cost-buy_cost)+ " dollars.")
#if net loss
else:
print("After the transaction, you lost " +str(buy_cost-sell_cost)+ " dollars.")
Explanation:
Read the total number of shares from user.Then read buying price of a share and selling price of a share.Then calculate total buying cost including commission.Calculate total selling cost excluding the commission.If total buying cost is greater than total selling cost the print the profit else print the loss in the transaction.
Output:
Enter number of shares:10
Enter purchase price:10
Enter sale price:10
After the transaction, you lost 6.0 dollars.