Questions
/*instructions: please do not change the general structure of the code that I already have please...

/*instructions: please do not change the general structure of the code that I already have

please write it in C programming

Define the interface for a queue ADT and implement it in two ways: one with a dummy node (or nodes) and one without.
In addition to the two standard queue functions you’ll need a function to create/initialize an empty queue,
a function to free an existing queue (which may not be empty),
and a function to return the size (number of keys) in the queue.
All functions should be as efficient as possible, e.g., the complexity of enqueue and dequeue must be O(1).
An additional requirement is that the underlying data structure should not be a doubly-linked list.*/

#include <stdio.h>
#include <stdlib.h>

typedef struct node{
int num;
struct node *next;
}Node;

typedef struct{
Node* front
Node* rear;
int size;
}Queue;

//Define the interface for a queue ADT
Queque* initializeQueque()
{
  
}

Queque* insert(int item)
{
  
}

Queque* delete()
{
  
}

void printList(Node* Q)
{
  
}

//get the size of the queque at postion [-1]
//return the size (number of keys) in the queue.
int getsize(Node* Q)
{
  
}

int main()
{
int option,item;
Node* Queque;
  
while(1){
printf("1.Insert number to queque\n2.Delete number from queque\n3.Display numbers in queque\n4.Exit\nEnter a option:");
scanf("%d",&option);
  
switch(option){
case 1:
printf("Enter the number:");
scanf("%d",&item);
Queque=insert(item);
break;
case 2:
Queque=delete();
break;
case 3:
printList(Queque);
break;
case 4:
return 1;
default:
printf("\nWrong input!\n");
break;
}
}
}

In: Computer Science

Modify the program so that, rather than printing data directly to the screen, it will read...

Modify the program so that, rather than printing data directly to the screen, it will read the data into an array of car structs and then print out the contents of the array.

#include "car.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

Car GetCar(ifstream& dataIn);

// Pre:  File dataIn has been opened.

// Post: The fields of car are read from file dataIn.

void WriteCar(ofstream& dataOut, Car car);

// Pre:  File dataOut has been opened.

// Post: The fields of car are written on file dataOut,

//       appropriately labeled.  

int main ()

{

  Car  car;

  ifstream dataIn;

  ofstream dataOut;

  dataIn.open("cars.dat");

  dataOut.open("cars.out");

  cout << fixed << showpoint;

  car = GetCar(dataIn);

  while (dataIn)

  {

    car.price = car.price * 1.10f;

    WriteCar(dataOut, car);

    car = GetCar(dataIn);

  }

  return 0;

}

//*****************************************************

Car GetCar(ifstream&  dataIn)

{

  Car car;

  dataIn >> car.customer;

  dataIn >> car.price  >> car.purchased.day        

         >> car.purchased.month  >> car.purchased.year;

  dataIn.ignore(2, '\n');

  return car;

}

                                                            

//*****************************************************

void  WriteCar(ofstream&  dataOut, Car  car)

{

  dataOut << "Customer: " << car.customer << endl

    << "Price:    " << car.price << endl

    << "Purchased:"  << car.purchased.day << "/"

    << car.purchased.month << "/"

    << car.purchased.year << endl;

}

.h file

#include <string>

struct PersonType {
    std::string firstname;
    std::string lastname;
};

struct Date
{
  int month;
  int day;
  int year;
};

struct Car
{
  float price;
  Date purchased;
  PersonType customer;
};

In: Computer Science

create a Java application program that will add up the cost of three items, then print...

create a Java application program that will add up the cost of three items, then print the final total with sales tax.

You should begin by prompting the user to enter three separate prices for three items that are being purchased. For each item you should ask for (in this order) the quantity of the product and the price of the product.

The program should compute, and be able to print to the screen:

the subtotal (the total amount due before tax)

sales tax (the amount of sales tax that will be added, assume 7% tax rate)

total due (subtotal + sales tax)

The following is an example of what your MIGHT see on the screen when your program runs. The exact output depends on what values that the user types in while the program runs. The user's values are shown below in italics:

Enter the quantity of the first product: 3
Enter the price of the first product: $5.25
Enter the quantity of the second product: 2
Enter the price of the second product: $1.83
Enter the quantity of the third product: 7
Enter the price of the third product: $0.89

Subtotal: $25.64
Sales Tax: $1.79
Total Due: $27.43

can post a screen shot of your java program Would like to learn the steps, i am doing intro to Java programing

In: Computer Science

You must use C Language. End Goal: HATFIELD, HEIDI KAISER, RUSSELL LIPSHUTZ, HOWARD PENKERT, DAWN WRIGHT,...

You must use C Language.

End Goal:

HATFIELD, HEIDI
KAISER, RUSSELL
LIPSHUTZ, HOWARD
PENKERT, DAWN
WRIGHT, ELIZABETH

The user inputs the students first name and last names separately but within one loop. The loop should end when the user presses enter on the first name without entering any text. Upon completing entry of data, the output pictured above should display on the output.

Using the code given, follow the steps:

1. You should be able to enter up to 20 student first names. Also, change the input array to an appropriate size of 18 for the length of the first name. Use a meaningful name for the storage of first names array. Change prompts as needed. The loop should exit when the user presses enter when inputing the first name without adding any text. Compile and make sure it works from main(). At this point, you should be able to enter and alphabetize a list of up to 20 first names! Alphabetizing the first name is just a test!!! In the end, you will alphabetize the whole name string.

2. Add another array and get input for last name INSIDE the loop for your first names. This last name array will also be an array of 20 elements but with room for up to 25 characters. Again, do not use another loop! Just add code to input the last name to the first loop. The program should now ask the user to input the student's first name and then last name in that order for each individual. Then the program will loop to continue adding student names until the user presses enter on the student's first name. Make sure the last name is converted to all caps. You do not need to alphabetize this array, but you may want to print it out to make sure everything is working just as a test.

3. Make changes to convert the first name to all upper case using a function. (Example: User enters bob on the first name, then on the last name enters jenkins, it will look like Bob Jenkins instead of bob jenkins)

Last step: Combine last and first into an third array. This code is most easily added to the first loop. You just had the user enter first and last names. So the current value of the subscript used for these arrays can be used to combine content and store in the third array.  Alphabetize THIS array (instead of the first name array) which means you need to send a different pointer to the stsrt() function. Print out the end result. Test that everything is working on this program.

Given Code:

void rollsheet(void) {
int ct = 0;
char *ptstr[LIMIT];
char input[LIMIT][SIZE];
int k;

printf("Enter up to %d student names, and I will sort them!\n", LIMIT);
printf("To stop, press the Enter key at a line's start.\n");
while (ct < LIMIT && s_gets(input[ct], SIZE) != NULL
&& input[ct][0] != '\0')
{
ptstr[ct] = input[ct]; /* set ptrs to strings */
ct++;
}
stsrt(ptstr,ct);
puts("\nHere's the sorted list:\n");
for (k = 0; k < ct; k++)
puts(ptstr[k]) ; /* sorted pointers */
}

void stsrt(char *strings[], int num)
{
char *temp;
int top, seek;

for (top = 0; top < num-1; top++)
for (seek = top + 1; seek < num; seek++)
if (strcmp(strings[top],strings[seek]) > 0)
{
temp = strings[top];
strings[top] = strings[seek];
strings[seek] = temp;
}
}


char * s_gets(char * st, int n)
{
char * ret_val;
int i = 0;

ret_val = fgets(st, n, stdin);
if (ret_val)
{
while (st[i] != '\n' && st[i] != '\0')
i++;
if (st[i] == '\n')
st[i] = '\0';
else // must have words[i] == '\0'
while (getchar() != '\n')
continue;
}
return ret_val;
}

In: Computer Science

Java Programming: In the program shown below, I want to print the result in the output...

Java Programming:

In the program shown below, I want to print the result in the output file. The main static method calls a method, displaySum which adds two integers and prints the result (sum). The problem is that I am not able to use "outputFile.print()" inside displaySum to print the content as the output file. I also want to display the content of two other methods, but I am facing this difficulty.

** DisplayOutput.java **

import java.io.*;
public class DisplayOutput
{
   public static void main(String[] args) throws IOException
   {
       FileWriter fw = new FileWriter("output.txt");
       PrintWriter outputFile = new PrintWriter(fw);
      
       outputFile.println("Suppose two inetegers are 2 and 3.");
       outputFile.println("Display the sum of two inetegers (2 and 3).");
       displaySum(2,3);
       outputFile.close();
   }
  
   private static void displaySum(int n1, int n2)
   {
       int sum = n1 + n2;
      
       outputFile.print("Sum of two integers (2 and 3) is: " + sum); // Error: outputFile cannot be resolved
   }  
}

In: Computer Science

Create a Java file that reads an excel file into an array. The array must be...

Create a Java file that reads an excel file into an array. The array must be binary.

In: Computer Science

Write a Java program called Numbers that reads a file containing a list of numbers and...

Write a Java program called Numbers that reads a file containing a list of numbers and outputs, for each number in the list, the next bigger number. For example, if the list is

78, 22, 56, 99, 12, 14, 17, 15, 1, 144, 37, 23, 47, 88, 3, 19

the output should look like the following:

78: 88

22: 23

56: 78

99: 144

12: 14

14: 15

17: 19

15: 17

1: 3

144: 2147483647

37: 47

23: 37

47: 56

88: 99

3: 12

19: 22

NOTE: If there is no bigger number in the sequence, just display the value of Integer.MAX_VALUE .

The output should be shown on the screen and also saved in a file.

Program Design

  • You should have a single class called Numbers.
  • You should have a static method called nextLargest, which takes as input an array of integers called list and another single integer called value. It should return the number that is the next larger than the value in the list (as described above). You need to use this method to implement your program.
  • The input file from which the list is read should be called "list.txt". Assume it's in the current directory.
  • The output file to which the results should be saved should be called "nextlist.txt". Save it in the current directory (i.e. don't specify the path).

Additional Requirements

  1. The name of your Java Class that contains the main method should be Numbers. All your code should be within a single file.
  2. Your code should follow good coding practices, including good use of whitespace (indents and line breaks) and use of both inline and block comments.
  3. You need to use meaningful identifier names that conform to standard Java naming conventions.
  4. At the top of the file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name.
  5. If the input file contains something not in the proper format, your program should handle this gracefully by displaying an appropriate message to the user and closing the program (without letting it crash).

The output of your program should exactly match the sample program output given at the end

In: Computer Science

(10) Let L = { <D> | D is a DFA that accepts sR whenever it...

(10) Let L = { <D> | D is a DFA that accepts sR whenever it accepts s } . Show that L is Turing-decidable.

In: Computer Science

Discussion Topics: Assume that you have a Saudi league player database. In this database, you have...

Discussion Topics:
Assume that you have a Saudi league player database. In this database, you have a table containing players’ attributes such as (Name, age, position, etc.) and you decided to add information about players’ agents. Would you represent the agent information as attributes in the player table or would you create an entity set for players’ agents? Justify your answer.   

Note: Provide answers in your own words.

In: Computer Science

Consider a file with a large number of Person(id, name, birth-date) records. Assume that users frequently...

Consider a file with a large number of Person(id, name, birth-date) records. Assume that users frequently search this file based on a the field id to find the values of name or birthdate for people whose information is stored in the file. Moreover, assume that users rarely update current records or insert new records to the file. Which file structure, heap versus sorted, provides the fastest total running time for users’ queries over this file? Explain your answer.

In: Computer Science

In matlab: Write a Bisection method with a while-loop that finds the root of the function...

In matlab:

Write a Bisection method with a while-loop that finds the root of the function f(x) = e^(−x) −x^2 + 2 between the values of [−5,5]. Write the function f(x) as a function file (a separate .m file). Use the error tolerance level of “tol = 1e-8.” Save the solved root value in the file A4.dat.

In: Computer Science

Write a program that prompts the user to enter five test scores and then print the...

Write a program that prompts the user to enter five test scores and then print the average test score to the screen. (Assume that the test scores are decimal numbers). Use the following 5 numbers:     10.5      5.5        20.0      10.0      5.5.

I am having trouble understanding where the 5 values are entered in the program.

The program has been provided:

#include <iostream>
    #include <iomanip>
   
    using namespace std;
    
    int main()
    {
        double testScore1;
        double testScore2;
        double testScore3;
        double testScore4;
        double testScore5;
   
        cout << "Enter test score 1: ";
        cin >> testScore1;
        cout << endl;
   
        cout << "Enter test score 2: ";
        cin >> testScore2;
        cout << endl;
       
        cout << "Enter test score 3: ";
        cin >> testScore3;
        cout << endl;
       
        cout << "Enter test score 4: ";
        cin >> testScore4;
        cout << endl;
       
        cout << "Enter test score 5: ";
        cin >> testScore5;
        cout << endl;
       
        cout << "Average test score: " << (testScore1+testScore2+testScore3+testScore4+testScore5)/5 << endl;
        cout << endl;
   

        // when using Visual Studio, use the system/pause command to display the results of your program
        // system("pause");


        return 0;
    }

In: Computer Science

Book Review: How America Lost Its Secrets?

Book Review: How America Lost Its Secrets?

In: Computer Science

NOTE: Write your program in 8086 language. Preferably, I'd like you to use emu8086, but you...

NOTE: Write your program in 8086 language. Preferably, I'd like you to use emu8086, but you can use any 8086 program and write and test them.

Program: Write a program to do the following.

(a) Scroll a window from row 5, column 10 to row 20, column 70, with a reverse video attribute.

(b) Locate the cursor at row 10, column 20.

(c) Display a line of text, such as,

THIS TEXT IS IN THE WINDOW

(d) After the line of text is displayed, wait for a key to be pressed.

(e) Scroll a window from row 7, column 12 to row 18, column 68, with a normal attribute.

(f) Write a character A with a blinking attribute in the middle of the window.

(g) Wait for a key stroke, and then clear entire screen with a normal attribute.

In: Computer Science

I want to take COMPTIA SECURITY+ EXAMS. ANY RELIABLE DUMPS RESOURCE THAT GUARANTEE A 100% PASS...

I want to take COMPTIA SECURITY+ EXAMS.

ANY RELIABLE DUMPS RESOURCE THAT GUARANTEE A 100% PASS ?

In: Computer Science