using System; namespace EnumApplication { class EnumProgram { enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat }; static void Main(string[] args) { int WeekdayStart = (int)Days.Mon; int WeekdayEnd = (int)Days.Fri; Console.WriteLine("Monday: {0}", WeekdayStart); Console.WriteLine("Friday: {0}", WeekdayEnd); Console.ReadKey(); } } }
Explanation:-
here, Enum is a primitive data type which is user-defined.
using System;
namespace EnumApplication {
class EnumProgram {
//user defined data type
enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
static void Main(string[] args) {
//it will give the week start that is monday position which is
1
int WeekdayStart = (int)Days.Mon;
//it will give the week end that is friday position which is
5
int WeekdayEnd = (int)Days.Fri;
Console.WriteLine("Monday: {0}", WeekdayStart); //it will print the
value
Console.WriteLine("Friday: {0}", WeekdayEnd);
Console.ReadKey();
}
}
}
Explain in steps on the following code What would be the output when executed using System;...
Given the following enumeration, what is the output from the printf(): enum day { sun, mon, tue, wed, thu, fri, sat}; enum day d; d = mon; prrintf("%d\n", d); a. mon b. 1 c. MON d. 0
for the following code I need the source code and output screenshot (includes date/time) in a PDF format. I keep getting an error for the #include "dayType.hpp" dayType.cpp #include"dayType.hpp" string dayType::weekday[7] = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat" }; //set the day void dayType::setDay(string day){ cout << "Set day to: " ; cin >> dayType::day; for(int i=0; i<7; i++) { if(dayType::weekday[i]==dayType::day) { dayType::markDay = i; } } } //print the day void dayType::printDay() { cout << "Day = "...
c++ What is the value of "Wed" given the following: enum DAYS { Sun, Mon = 0, Tue = 4, Wed, Thu = 7, Fri, Sat } Select one: a. 10 b. -1 c. 5 d. 6 What returns the number of bytes in a data type or variable? Select one: a. bytesize b. length c. sizeof d. bytes
Code in PYTHON I have a small company. I need a payroll system that calculates the pay and taxes for each employee. I have the following input files: • EmployeeData ENum,ELName,EFName,Work Area,HrlyRate 1101,Davis,Mike,7,24.85 1385,Smith,William,1,19.50 1524,White,James,3,23.50 1998,Stuart,Mary,1,25.00 2358,Scott,Richard,4,20.00 2765,Mills,Jason,5,21.00 2945,Schultz,Cindy,7,23.50 4789,Moffett,William,3,30.00 5304,Rangel,Ken,2,28.00 5521,Rodriguez,Teresa,4,29.00 6447,Butler,Craig,2,18.50 6512,Russell,Don,6,26.00 6614,Wilson,Keith,1,28.50 6749,Johnson,Darrell,6,32.00 7325,Butler,Eileen,4,17.00 7886,Williams,Gina,1,21.00 8356,Roberts,Judy,8,23.00 8466,Soto,Glen,8,22.50 9458,Cooper,Lia,4,26.50 9896,Bonds,Lisa,5,27.00 • TaxTable LRange,URange,TaxAmt 0.01,200.00,20.00 200.01,400.00,50.00 400.01,600.00,75.00 600.01,800.00,100.00 800.01,1000.00,120.00 1000.01,1200.00,150.00 1200.01,1400.00,180.00 1400.01,1600.00,220.00 1600.01,1800.00,250.00 1800.01,2000.00,300.00 2000.01,2200.00,325.00 2200.01,2500.00,350.00 starting at zero and ending at 2,500.00. • TimeCardData ENum,Day,DailyHours 1101,FRI,8.00 1101,MON,8.00 1101,THU,8.00...
Will give positive rating! AM/PM Method Assignment # 03: Calculate the early and late dates for the following activities, and create a bar chart. Assuming a Monday to Friday working week and the first activity starting on Dec 01 20XX. 1-Dec Activity A Activity B Activi Activity F Activity G 2 days da 3 da da 2 da Activity C Activity E 3 da 3 da SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY 2 4 Fulil Mocn NW 10 12...
Program 5: Design (pseudocode) and implement (source code) a program (name it Weekl yHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers' daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers between 0 and...
%) Problem 4.41 (additional/static) The director of the Riley County, Kansas, library system would like to forecast evening patron usage for next week. Below are the data for the past 4 weeks: Week 1 Week 2 Week 3 Week 4 Mon Tue 210 178 215 180 220176 225 178 Wed 250 250 260 260 Thu Fri 215 160 213 165 220175 225 176 Sat 180 185 190 190 a) Calculate a seasonal index for each day of the week (enter...
10. What prints when the following code is executed? public static void main (String args) "Cattywampus"; for (int i-s.length )-1 i> 0 i-2) if (s.charAt (i)a') System.out.print(""); ] else if (s.charAt (i)'t') System.out.print (s.charAt (i-2)) i+ti else System. out. print (s . charAt (İ) ) ; if (i<2) System.out.print ("y"); System.out.println () 10. What prints when the following code is executed? public static void main (String args) "Cattywampus"; for (int i-s.length )-1 i> 0 i-2) if (s.charAt (i)a') System.out.print(""); ]...
IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it WeeklyHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers’ daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers...
In [19]: System.out.printf("%3s%85\n", "Day", "Index"); System.out.printf("===========\n"); for (int i = 0; i < days.length; i++) { System.out.printf("%35%8d\n", days[i], i); Day Index sun mon tue wed & ! Om to thu fri sat CODING CHALLENGE 02 Copy the code above into the main function of a Java program named DaysArray.java and change the for loop to a while loop.