Use a two-dimensional array in the following problem. Your task is to create a simple Java program which would solve this problem.
You MUST use a 2D array of Strings to solve this problem.
Use a two-dimensional array in the following problem. . Your task is to create a simple Java program which would solve this problem.
You MUST use a 2D array of Strings to solve this problem.
Ask the user which cart of laptops they wish to book. For simplicity sake assume there are 6 laptop carts available for booking.
Ask the user which period they wish to book. Assume there are 4 periods available for when they can book out laptops.
Ask the user the name of the teacher who is booking and store that name into the 2D array at the appropriate location.
Allow the user to loop the program and book another teacher if they wish. If the user picks a slot already used by a teacher it's ok, allow them to overwrite the existing teacher's name in that spot.
days= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
a= input()
b = int(input())
i = b % 7 -1
if a in days:
d = days.index(a)+i
if d >= 7:
d = d - 7
print(days[d-1])
this code is not working
how to print days
You are given a list L. Write a program to print all numbers in the list which are exactly repeated twice. The order of numbers should be same as in list.(for example if 3 appeared before 2 3 should be printed first.)
If no such number exist do not print anything. (input will be handled by us)
Input
[2,2,3,4,5,6,6,7,8,8,8,10, 3]
output
2
3
6
Explanation
Since 2, 3 and 6 is repeated 2 times output is 2, 3 and 6, whereas 8 is repeated 3 times so it is not printed.
Write a function that takes an input parameter as a String. The function should replace the alternate words in it with “xyz” and print it. Words are separated by dots. (Avoid using inbuilt function) If input is “i.like.this.program.very.much” Output will be “i.xyz.this.xyz.very.xyz” in java
num1 = int(input("Enter a Number: "))
num2 = int(input("Enter another Number: "))
operator = str(input("Enter the Operation you want: "))
if operator == "+":
print("Result is:" , (num1 + num2))
elif operator == "-":
print("Result is:" , (num1 - num2))
elif operator == "*":
print("Result is:" , (num1 * num2))
elif operator == "/":
print("Result is:" , (num1 / num2))
elif operator == "%":
print("Result is:" , (num1 % num2))
error in output: File "main.py", line 1, in <module>
num1 = int(input())
ValueError: invalid literal for int() with base 10:
n = int(input())
line = []
for i in range(0, n):
line.append(input())
print(max(line))
#test cases failedDevelop a custom class called Contact(Name, Dob, Phonenumber) which has methods such as Read() and Display() with the following criterions. Read Name (Text: maximum length 50), Dob(Date: after 01/01/2000) and
Phone numbers(Integer) from user and some of these accepting only a specific format with the four-digit area and six-digit local codes accepted as ten digits, or separated into blocks using hyphens or spaces, and with the area code optionally enclosed in parentheses.
For example, all of these are valid: 0426-123-456, (0432) 123456 and 0432
123456.
Read the phone numbers from console and for each one echo the number in the form "(999) 999 9999" or report an error for any that are invalid, or that don't have exactly ten digits.
Show how the object creations and manipulations are done for 'N' valid
Contacts.
Finally store the contacts in a separate .csv file
by CodeChum Admin
Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is 'x'.
more details here. Important!
https://pastebin.com/wMX2BhFk