Every time I run this code I get two errors. It's wrote in C# and I can't figure out what I'm missing or why it's not running properly. These are two separate classes but are for the same project.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RecursiveMethod
{
class Program
{
static bool ordering = true;
static string str;
static int quantity = 0;
static string Invoic = string.Empty;
static double itemPrice;
static double totalCost = 0;
static void Main(string[] args)
{
int menuOption;
int Item = 0;
Console.WriteLine("Enter your FirstName"); //First Name
string sFirstName = Console.ReadLine();
Console.WriteLine("Enter your LastName"); //Last Name
string sLastName = Console.ReadLine();
Console.WriteLine("Enter your ID"); //Last Name
string sStudentID = Console.ReadLine();
str = sFirstName + sLastName;
//Call this methos to show student info staring of the programm
displayStudentInfo(str,sStudentID);
//display your message function
displayMessage(str);
string invoice = string.Empty;
while (ordering)
{
Console.WriteLine("Enter your item");
menuOption = Convert.ToInt32(Console.ReadLine());
double cost;
switch (menuOption)
{
case 1:
Item = 1;
ProgressLogic.addItem(1, invoice, out Invoic, out quantity,out itemPrice);
invoice = Invoic;
cost = displayTotal(itemPrice, quantity);
break;
case 2:
Item = 2;
ProgressLogic.addItem(2, invoice, out Invoic, out quantity, out itemPrice);
invoice = Invoic;
cost = displayTotal(itemPrice, quantity);
break;
case 0:
done(totalCost, invoice);
Console.ReadLine();
break;
default:
Console.WriteLine("Invalid Option");
break;
}
}
}
/// <summary>
/// Show the Message
/// </summary>
/// <param name="str"></param>
public static void displayMessage(string str)
{
Console.WriteLine("Welcome " + str + " to dave onlines coffee shop");
}
/// <summary>
/// Show the Student Info
/// </summary>
/// <param name="studentFullName"></param>
/// <param name="iStudentID"></param>
public static void displayStudentInfo(string studentFullName, string iStudentID)
{
Console.WriteLine("Welcome " + studentFullName + " Student ID - " + iStudentID);
Console.WriteLine("Please choose the following Products code. Enter 0 to Exit");
Console.WriteLine("Product 1 kona bled -> $14.95");
Console.WriteLine("Product 2 cafe verona -> $9.95");
}
/// <summary>
/// Done Method to show the information based on the total cost calculations
/// </summary>
/// <param name="totalCost"></param>
public static void done(double totalCost, string strInvoice)
{
ordering = false;
Console.WriteLine("Customer Name");
Console.WriteLine("\n"+ strInvoice);
Console.WriteLine("\n"+"Total Cost"+ totalCost + "$");
}
/// <summary>
/// Disaply the total cost
/// </summary>
/// <param name="itemPrice"></param>
/// <param name="quant"></param>
/// <returns></returns>
public static double displayTotal(double itemPrice, double quant)
{
double cost = (itemPrice * quant);
totalCost += cost;
return totalCost;
}
}
}
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RecursiveMethod
{
public class ProgressLogic
{
//This method will do the programming logic and will return the calculations in the out parameter
public static double addItem(int item, string oldInvoiceString, out string Invoice, out int quantity, out double itemPrice) {
//we need to initialize the out parameters first so definitily it will some value instead of nothig
//ow it will show error
Invoice = "";
quantity = 0;
itemPrice = 00.00;
if (item == 1) {
itemPrice = 14.95;
Console.WriteLine("Enter Quantity"); //Last Name
quantity = Convert.ToInt32( Console.ReadLine());
Invoice = oldInvoiceString + " Product 1 kona Blend -> $" + itemPrice + " * " + quantity + " = " + itemPrice * quantity + "\n";
}
if (item == 2)
{
itemPrice = 9.95;
Console.WriteLine("Enter Quantity"); //Last Name
quantity = Convert.ToInt32(Console.ReadLine());
Invoice = oldInvoiceString + "Product 2 cafe verona-> $" + itemPrice + " * " + quantity + " = " + itemPrice * quantity + "\n";
}
return itemPrice;
}
}
}In: Computer Science
You are asked to write a simple C++ phonebook application program. Here are the requirements for the application.
A sample run:
***MY PHONEBOOK APPLICATION***
Please choose an operation:
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): A
Enter name: MARY SMITH
Enter phone: 5062396
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): S
Enter name: MARY SMITH
Phone Number: 5062396
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L
BARBARA BROWN 4059171
ELIZABETH JONES 2736877
LINDA WILLIAMS 3532665
PATRICIA JOHNSON 973437
…
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): D
Enter name: LINDA WILLIAMS
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L
BARBARA BROWN 4059171
ELIZABETH JONES 2736877
PATRICIA JOHNSON 973437
…
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): Q
In: Computer Science
One tents has provided their per-unit sales and cost information for the year ended December 31, 2018. All per-unit costs below are based on the production and sale of 3,000 name tents. the relevant range is 0 - 3,500 tents
Sales $45
Costs
variable costs
direct materials 5
direct labor 7
Manufacturing Overhead 13
Period Costs 4
Fixed Costs
Manufacturing Overhead 5
Period cost 7
1. if 2000 tents are produced and sold, what is the product cost per tent?
2. what is the fixed cost per tent at 1000 tents( including costs) produced and sold?
3. what are the total fixed costs in this example at 2000 name tent (produced and sold)?
4. what are the total variable costs in this example at 2000 name tents (produced and sold)?
5. what are the total period costs at 2000 name tents(produced and sold)?
6. will Nancy's turn a profit if they sell 2000 name tents?
7. what is the cost equation of nancy's?
8. what is the contribution margin per unit?
9. how many units does nancy need to sell in order to break even if she them at the price listed at above?
10. if nancy expects to sell only 2000 tents, what price should she charge to break even?
In: Accounting
In: Computer Science
In: Computer Science
PYTHON - You are given a data.csv file in the /root/customers/ directory containing information about your customers. It has the following columns: ID,NAME,CITY,COUNTRY,CPERSON,EMPLCNT,CONTRCNT,CONTRCOST where ID: Unique id of the customer NAME: Official customer company name CITY: Location city name COUNTRY: Location country name CPERSON: Email of the customer company contact person EMPLCNT: Customer company employees number CONTRCNT: Number of contracts signed with the customer CONTRCOST: Total amount of money paid by customer (float in format dollars.cents) Read and analyze the data.csv file, and output the answers to these questions: How many total customers are in this data set? How many customers are in each city? How many customers are in each country? Which country has the largest number of customers' contracts signed in it? How many contracts does it have? How many unique cities have at least one customer in them? The answers should be formatted as: Total customers: Customers by city: : : ... Customers by country: : : ... Country with most customers' contracts: USA ( contracts) Unique cities with at least one customer: The answers for Customers by city and Customers by country must be sorted by CITY and COUNTRY respectively, in ascending order. If there are several cities that are tied for having the most customers' contracts, print the lexicographically bigger one.
In: Computer Science
Identify every possible primary key, candidate key, and foreign key for the following relations. Separate each key using a semicolon to avoid confusion.
Assumptions: MIScompany has branches located in several states within the United States. A customer can be an individual or organization. driverId is the driving license number, ssno is the social security number and upc is the universal product code. Any equipment is rented and returned at the same branch. A customer can be a manufacturer and vice versa. (Minus 1 point for each wrong answer)
MIScompany (name, address, phone, email, FedTaxId, StaTaxId)
Primary key:
Candidate key:
Foreign key: none
branch (branchId, name, address, phone, email, FedTaxId, StaTaxId)
Primary key:
Candidate key:
Foreign key:
employee (empId, driverId, ssno, name, branchId)
Primary key:
Candidate key:
Foreign key:
customer (custId, name, address, driverId, ssno, FedTaxId, StaTaxId)
Primary key:
Candidate key:
Foreign key:
equipment (equipId, type, upc, purchaseDate, year, manufacturId, cost, rentFee, branchId)
Primary key:
Candidate key:
Foreign key:
manufacturer (manufacturId, name, FedTaxId, StaTaxId, phone, email)
Primary key:
Candidate key:
Foreign key:
rental (rentalId, equipId, custId, rentDate&time, returnDate&time, empId, branchId)
Primary key:
Candidate key:
Foreign key: equipId;
In: Computer Science
We will extend project 2 by wrapping our input and output in a while loop. Repeatedly do the following:
Prompt the user for their name, get and store the user input.
Prompt the user for their age, get and store the user input. We will assume that the user will enter a positive integer and will do no error checking for valid input.
Determine and store a movie ticket price based on the user's age. If their age is 12 or under, the ticket price is $5. If their age is between 13 and 64, inclusive, the ticket price is $10. If their age is 65 or greater, the ticket price is $8.
When all the user input has been gathered, print out a meaningful label such as 'Name: ' followed by the entire user name on one line. On the next line, print out a meaningful label such as 'Age: ' followed by the user's age. On the next line, print out a meaningful label such as 'Ticket Price: ' followed by the ticket price your program calculated. Your output should look something like this:
Name: Mickey M Mouse
Age: 19
Ticket Price: $10
Now prompt the user asking if they would like to enter another ticket buyer's name. If they answer 'y' for yes, perform the loop again getting the input from the user, calculate the ticket price, and output the information. If the user answers anything other than 'y' the loop should exit.
in Python please
In: Computer Science
I am getting the following error: SalaryCalc.java:41: error: variable shift might not have been initialized if(shift==0) ^ 1 error
Please FIX
This is my Java code:
import java.util.Scanner;
public class SalaryCalc
{
double Rpay=0, Opay=0;
void calPay(double hours, double rate){
if(hours<=40){
Rpay = hours * rate;
Opay = 0;
}
else {
double Rhr,Ohr;
Rhr = 40;
Ohr = hours-Rhr;
Rpay = Rhr * rate;
Opay = Ohr * (1.5*rate);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name;
int shift;
Double rate, hours;
System.out.println("Pay Calculator");
System.out.println("Enter Your Name");
name=sc.next();
System.out.println("Enter Your Shift, Enter 0 for Day, Enter1 for
Night");
System.out.println("0=Day, 1= Night");
System.out.println("Enter Number of Hours Worked");
hours=sc.nextDouble();
System.out.println("Enter Hourly Pay");
rate=sc.nextDouble();
SalaryCalc c= new SalaryCalc();
c.calPay(hours,rate);
Double Tpay= c.Rpay+ c.Opay;
System.out.println();
System.out.println("Calculate Pay");
System.out.println("Employee Name: "+name);
System.out.println("Employee Regular Pay: "+c.Rpay);
System.out.println("Employee Overtime Pay: "+c.Opay);
System.out.println("Employee Total Pay: "+Tpay);
if(shift==0)
{
System.out.println("Employee PayPeriod is Friday");
}
else{
System.out.println("Employee PayPeriod is Saturday");
}
}
}
In: Computer Science
Updating the following Java program below, I need to continue to take input for every employee in a company, and display their information until a sentinel value is entered that exits the loop and ends the program
import java.util.Scanner;
public class SalaryCalc
{
double Rpay=0, Opay=0;
void calPay(double hours, double rate)
{
if(hours<=40)
{
Rpay = hours * rate;
Opay = 0;
}
else
{
double Rhr,Ohr;
Rhr = 40;
Ohr = hours-Rhr;
Rpay = Rhr * rate;
Opay = Ohr * (1.5*rate);
}
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String name;
int shift = 0;
Double rate, hours;
System.out.println("Pay Calculator");
System.out.println("Enter Your Name");
name=sc.next();
System.out.println("Enter Your Shift, Enter 0 for Day, Enter1 for
Night");
System.out.println("0=Day, 1= Night");
System.out.println("Enter Number of Hours Worked");
hours=sc.nextDouble();
System.out.println("Enter Hourly Pay");
rate=sc.nextDouble();
SalaryCalc c= new SalaryCalc();
c.calPay(hours,rate);
Double Tpay= c.Rpay+ c.Opay;
System.out.println();
System.out.println("Calculate Pay");
System.out.println("Employee Name: "+name);
System.out.println("Employee Regular Pay: "+c.Rpay);
System.out.println("Employee Overtime Pay: "+c.Opay);
System.out.println("Employee Total Pay: "+Tpay);
if(shift==0)
{
System.out.println("Employee PayPeriod is Friday");
}
else
{
System.out.println("Employee PayPeriod is Saturday");
}
}
}
In: Computer Science